Skip to content

Commit

Permalink
zauberzeug#287 disabling implicit wait for input query
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Feb 2, 2023
1 parent b4b3ea5 commit 947873a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 947873a

Please sign in to comment.