From 947873a31622483593ef0a20b904d63f5b02cfd3 Mon Sep 17 00:00:00 2001 From: Rodja Trappe Date: Thu, 2 Feb 2023 08:45:46 +0100 Subject: [PATCH] #287 disabling implicit wait for input query --- tests/conftest.py | 2 +- tests/screen.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1ba716602..78495d175 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -30,7 +30,7 @@ def capabilities(capabilities: Dict) -> Dict: @pytest.fixture def selenium(selenium: webdriver.Chrome) -> webdriver.Chrome: - selenium.implicitly_wait(4) + selenium.implicitly_wait(Screen.IMPLICIT_WAIT) selenium.set_page_load_timeout(4) return selenium diff --git a/tests/screen.py b/tests/screen.py index f82c8869b..ed0bf048c 100644 --- a/tests/screen.py +++ b/tests/screen.py @@ -17,6 +17,7 @@ class Screen: + IMPLICIT_WAIT = 4 SCREENSHOT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'screenshots') UI_RUN_KWARGS = {'port': PORT, 'show': False, 'reload': False} @@ -111,9 +112,11 @@ def find(self, text: str) -> WebElement: raise AssertionError(f'Found "{text}" but it is hidden') return element except NoSuchElementException as e: + self.selenium.implicitly_wait(0) for input in self.selenium.find_elements(By.TAG_NAME, 'input'): if input.get_attribute('value') == text: return input + self.selenium.implicitly_wait(self.IMPLICIT_WAIT) raise AssertionError(f'Could not find "{text}"') from e def render_js_logs(self) -> str: