Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
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.
✗ Incorrect
The Duration.ofSeconds(10) method correctly creates a Duration of 10 seconds for the WebDriverWait timeout.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
The elementToBeClickable condition waits until the element is visible and enabled so it can be clicked.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect capitalization causing method not found errors.
Using 'contain' instead of 'contains'.
✗ Incorrect
The correct method name is titleContains with a lowercase 'c' in contains.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using visibilityOfElementLocated which waits for visibility, not invisibility.
Using By.id instead of By.className for class selectors.
✗ Incorrect
invisibilityOfElementLocated waits until the element is not visible, and className locator finds elements by class attribute.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using By.id instead of By.cssSelector for CSS selectors.
Using presenceOfElementLocated which does not guarantee visibility.
✗ Incorrect
visibilityOfElementLocated waits for visibility, cssSelector locates by CSS selector, and ".menu-item" is the CSS selector string.