Poll element.get_attribute("value") for change. Args: element: selenium webdriver element to check timeout: how long to poll element value attribute exp_not_equal: exit the polling loop when the value does not match Returns: The eleme
(
self,
element: WebElement,
timeout: TimeoutType = None,
exp_not_equal: str | Sequence[str] = "",
)
| 716 | return element.text |
| 717 | |
| 718 | def poll_for_value( |
| 719 | self, |
| 720 | element: WebElement, |
| 721 | timeout: TimeoutType = None, |
| 722 | exp_not_equal: str | Sequence[str] = "", |
| 723 | ) -> str | None: |
| 724 | """Poll element.get_attribute("value") for change. |
| 725 | |
| 726 | Args: |
| 727 | element: selenium webdriver element to check |
| 728 | timeout: how long to poll element value attribute |
| 729 | exp_not_equal: exit the polling loop when the value does not match |
| 730 | |
| 731 | Returns: |
| 732 | The element value when the polling loop exited |
| 733 | |
| 734 | Raises: |
| 735 | TimeoutError: when the timeout expires before value changes |
| 736 | """ |
| 737 | exp_not_equal = ( |
| 738 | (exp_not_equal,) if isinstance(exp_not_equal, str) else exp_not_equal |
| 739 | ) |
| 740 | if not self._poll_for( |
| 741 | target=lambda: element.get_attribute("value") not in exp_not_equal, |
| 742 | timeout=timeout, |
| 743 | ): |
| 744 | msg = f"{element} content remains {exp_not_equal!r} while polling." |
| 745 | raise TimeoutError(msg) |
| 746 | return element.get_attribute("value") |
| 747 | |
| 748 | @staticmethod |
| 749 | def poll_for_or_raise_timeout( |
no test coverage detected