Open johanno opened 6 years ago
Also the negation:
@keyword
def wait_until_element_does_not_contain_attribute(self, attribute_locator, unexpected,
timeout=None, error=None):
"""Waits until element attribute identified by ``attribute_locator``
does not contain ``unexpected``.
Fails if ``timeout`` expires before the ``unexpected`` element attribute
goes away from the page.
Arguments:
- ``attribute_locator``: The locator to find requested element attribute. It consists of
element locator followed by an @ sign and attribute name,
for example "element_id@class".
- ``unexpected``: The unexpected element attribute value.
- ``timeout``: The maximum value to wait for ``unexpected`` element attribute to go away.
See `introduction` for more information about ``timeout`` and
its default value.
- ``error``: The value that would be use to override the default error message.
See also `Wait Until Element Contains Attribute`, `Wait Until Page Contains`,
`Wait Until Page Contains Element`, `Wait For Condition`,
`Wait Until Element Is Visible` and BuiltIn keyword `Wait Until Keyword Succeeds`.
Examples:
| Wait Until Element Does Not Contain Attribute | css=div.class@class | value |
"""
# pylint: disable=no-member
timeout = self._get_timeout_value(timeout, self._timeout_in_secs)
if not error:
error = "Element was still contain attribute '%s' after %s" %\
(unexpected, secs_to_timestr(timeout))
# pylint: disable=no-member
WebDriverWait(self, timeout, self._inputs['poll_frequency']).\
until_not(lambda driver: unexpected in driver.get_element_attribute(attribute_locator),
error)
@aaltat Hey Tatu! I would love to take a stab at this as this hasn't been done yet. Just confirming that the goal is to add New Keyword 'Wait Until Element Contains attribute' and the inverse to the SeleniumLibrary similarly like how it is in the ExtendedSelenium2Library?
This is not yet done. I am just wondering about the use case, because the original issue writer does not mention it. Is it enough to wait that attribute is present or is not present in the element? Or would it be more useful to wait that element attribute contains a value or does not contain the value? Or is there need for both use cases?
I don't have need for such keywords and therefore I don't see which one would be more beneficial to do, or are both needed. What do you think?
After some thought, from personal experience I have not had the need to check the value of the attribute or the existence of an attribute. The other wait keywords already defined in SeleniumLibrary were enough. So I feel like we should avoid adding this keyword as there are not too many use cases for this. But If in the future others find that this would be beneficial, we can revisit this.
Copied from ExtendedSelenium2Library: