0
0
Selenium Javatesting~10 mins

FluentWait with polling in Selenium Java - 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 with a timeout of 30 seconds.

Selenium Java
FluentWait<WebDriver> wait = new FluentWait<>(driver).withTimeout(Duration.ofSeconds([1]));
Drag options to blanks, or click blank then click option'
A20
B10
C30
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Using a timeout value too small causing premature timeout.
Forgetting to use Duration.ofSeconds.
2fill in blank
medium

Complete the code to set the polling interval to 5 seconds.

Selenium Java
wait.pollingEvery(Duration.ofSeconds([1]));
Drag options to blanks, or click blank then click option'
A1
B5
C10
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Setting polling interval longer than timeout.
Using wrong Duration method.
3fill in blank
hard

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

Selenium Java
wait.ignoring([1].class);
Drag options to blanks, or click blank then click option'
ANoSuchElementException
BElementNotVisibleException
CTimeoutException
DStaleElementReferenceException
Attempts:
3 left
💡 Hint
Common Mistakes
Ignoring wrong exception causing wait to fail early.
Forgetting to add .class after exception name.
4fill in blank
hard

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

Selenium Java
FluentWait<WebDriver> wait = new FluentWait<>(driver).withTimeout(Duration.ofSeconds([1])).pollingEvery(Duration.ofSeconds([2]));
Drag options to blanks, or click blank then click option'
A20
B5
C2
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Setting polling interval longer than timeout.
Swapping timeout and polling values.
5fill in blank
hard

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

Selenium Java
FluentWait<WebDriver> wait = new FluentWait<>(driver).withTimeout(Duration.ofSeconds([1])).pollingEvery(Duration.ofSeconds([2])).ignoring([3].class);
Drag options to blanks, or click blank then click option'
ANoSuchElementException
B3
CStaleElementReferenceException
D15
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong exception to ignore.
Mixing up timeout and polling values.