0
0
Selenium Pythontesting~10 mins

Fluent waits in Selenium Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a FluentWait object with a timeout of 30 seconds.

Selenium Python
wait = WebDriverWait(driver, [1])
Drag options to blanks, or click blank then click option'
A10
B60
C30
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using too short a timeout like 5 seconds may cause premature failures.
Confusing timeout with polling interval.
2fill in blank
medium

Complete the code to set the polling interval to 2 seconds in the FluentWait.

Selenium Python
wait = WebDriverWait(driver, 30, poll_frequency=[1])
Drag options to blanks, or click blank then click option'
A2
B1
C5
D0.5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting polling interval too high causes slow tests.
Using polling interval larger than timeout.
3fill in blank
hard

Fix the error in the code to ignore NoSuchElementException during the wait.

Selenium Python
wait = WebDriverWait(driver, 30, ignored_exceptions=[[1]])
Drag options to blanks, or click blank then click option'
ANoSuchElementException
BTimeoutException
CElementNotVisibleException
DStaleElementReferenceException
Attempts:
3 left
💡 Hint
Common Mistakes
Ignoring the wrong exception causes the wait to fail immediately.
Not ignoring any exception causes test flakiness.
4fill in blank
hard

Fill both blanks to create a FluentWait that waits 20 seconds and polls every 1 second.

Selenium Python
wait = WebDriverWait(driver, [1], poll_frequency=[2])
Drag options to blanks, or click blank then click option'
A20
B1
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Setting polling interval longer than timeout.
Using very short polling intervals causing performance issues.
5fill in blank
hard

Fill all three blanks to create a FluentWait that waits 20 seconds, polls every 2 seconds, and ignores StaleElementReferenceException.

Selenium Python
wait = WebDriverWait(driver, [1], poll_frequency=[2], ignored_exceptions=[[3]])
Drag options to blanks, or click blank then click option'
A20
B2
CStaleElementReferenceException
DNoSuchElementException
Attempts:
3 left
💡 Hint
Common Mistakes
Ignoring the wrong exception.
Setting polling interval equal or longer than timeout.