0
0
Selenium Javatesting~10 mins

Explicit wait (WebDriverWait) 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 an explicit wait with a timeout of 10 seconds.

Selenium Java
WebDriverWait wait = new WebDriverWait(driver, Duration.[1]);
Drag options to blanks, or click blank then click option'
Await(10)
Bseconds(10)
Ctimeout(10)
DofSeconds(10)
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like seconds() or timeout() which do not exist in Duration.
Passing an integer directly instead of a Duration object.
2fill in blank
medium

Complete the code to wait until the element located by id "submit" is clickable.

Selenium Java
wait.until(ExpectedConditions.[1](By.id("submit")));
Drag options to blanks, or click blank then click option'
AvisibilityOfElementLocated
BpresenceOfElementLocated
CelementToBeClickable
DalertIsPresent
Attempts:
3 left
💡 Hint
Common Mistakes
Using visibilityOfElementLocated which only checks visibility, not clickability.
Using presenceOfElementLocated which only checks presence in DOM, not visibility or clickability.
3fill in blank
hard

Fix the error in the code to wait for the title to contain "Dashboard".

Selenium Java
wait.until(ExpectedConditions.title[1]("Dashboard"));
Drag options to blanks, or click blank then click option'
Acontains
BContains
Ccontain
DContain
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect capitalization causing method not found errors.
Using 'contain' instead of 'contains'.
4fill in blank
hard

Fill both blanks to wait until the element with class "loading" is invisible.

Selenium Java
wait.until(ExpectedConditions.[1](By.[2]("loading")));
Drag options to blanks, or click blank then click option'
AinvisibilityOfElementLocated
BvisibilityOfElementLocated
CclassName
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using visibilityOfElementLocated which waits for visibility, not invisibility.
Using By.id instead of By.className for class selectors.
5fill in blank
hard

Fill all three blanks to wait until the element with CSS selector ".menu-item" is visible and then click it.

Selenium Java
WebElement menu = wait.until(ExpectedConditions.[1](By.[2]("[3]")));
menu.click();
Drag options to blanks, or click blank then click option'
AvisibilityOfElementLocated
BcssSelector
C.menu-item
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using By.id instead of By.cssSelector for CSS selectors.
Using presenceOfElementLocated which does not guarantee visibility.