Skip to content

Commit 89bf6e7

Browse files
committed
Wait until instead
1 parent f180e1f commit 89bf6e7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

tests/tabs/test_mute_tabs.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,10 @@ def test_mute_unmute_tab(screenshot, driver: Firefox, video_url: str):
3333
tabs.expect(EC.title_contains("mov_bbb.mp4"))
3434

3535
with driver.context(driver.CONTEXT_CHROME):
36-
sound_status = False
37-
retries = 0
38-
while not sound_status and retries < RETRY_LIMIT:
39-
try:
40-
sound_status = tabs.expect_tab_sound_status(
41-
1, tabs.MEDIA_STATUS.PLAYING
42-
)
43-
except NoSuchElementException:
44-
logging.info("Tab sound status not found")
45-
retries += 1
46-
sleep(0.5)
36+
tab = tabs.get_tab(1)
37+
tabs.wait.until(
38+
lambda _: tab.get_attribute(tabs.MEDIA_STATUS.PLAYING) is not None
39+
)
4740

4841
tabs.click_tab_mute_button(1)
4942
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.MUTED)

0 commit comments

Comments
 (0)