Raises an exception if the element attribute/value is not found. If the value is not specified, the attribute only needs to exist. Returns the element that contains the attribute if successful. Default timeout = LARGE_TIMEOUT.
(
self, selector, attribute, value=None, by="css selector", timeout=None
)
| 8486 | return self.assertRaises(*args, **kwargs) |
| 8487 | |
| 8488 | def wait_for_attribute( |
| 8489 | self, selector, attribute, value=None, by="css selector", timeout=None |
| 8490 | ): |
| 8491 | """Raises an exception if the element attribute/value is not found. |
| 8492 | If the value is not specified, the attribute only needs to exist. |
| 8493 | Returns the element that contains the attribute if successful. |
| 8494 | Default timeout = LARGE_TIMEOUT.""" |
| 8495 | self.__check_scope() |
| 8496 | if not timeout: |
| 8497 | timeout = settings.LARGE_TIMEOUT |
| 8498 | if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT: |
| 8499 | timeout = self.__get_new_timeout(timeout) |
| 8500 | selector, by = self.__recalculate_selector(selector, by) |
| 8501 | if self.__is_cdp_swap_needed(): |
| 8502 | self.cdp.assert_element_attribute(selector, attribute, value) |
| 8503 | return |
| 8504 | elif self.__is_shadow_selector(selector): |
| 8505 | return self.__wait_for_shadow_attribute_present( |
| 8506 | selector, attribute, value=value, timeout=timeout |
| 8507 | ) |
| 8508 | return page_actions.wait_for_attribute( |
| 8509 | self.driver, |
| 8510 | selector, |
| 8511 | attribute, |
| 8512 | value=value, |
| 8513 | by=by, |
| 8514 | timeout=timeout, |
| 8515 | ) |
| 8516 | |
| 8517 | def assert_attribute( |
| 8518 | self, selector, attribute, value=None, by="css selector", timeout=None |
no test coverage detected