Created
June 7, 2024 05:59
-
-
Save SarahElson/057015908bc365e6dec8cc4f420bd3a1 to your computer and use it in GitHub Desktop.
How to Wait in Python: Python Wait Tutorial With Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pytest | |
| from pages.fluent_wait import * | |
| from selenium.webdriver.support.wait import WebDriverWait | |
| @pytest.mark.usefixtures("driver") | |
| def test_fluent_wait(driver): | |
| fluent_wait = FluentWait(driver) | |
| fluent_wait.click_my_account() | |
| password_input = fluent_wait.get_password_input() | |
| # fluent wait method involves providing | |
| # arguments for poll_frequency and sometimes ignored_exceptions | |
| WebDriverWait(driver, 10, poll_frequency=2).until( | |
| lambda el: password_input.is_displayed() | |
| ) | |
| my_password = "password" | |
| password_input.send_keys(my_password) | |
| assert password_input.get_property("value") == my_password \ | |
| , f"Expected password value to equal {my_password}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment