Complete the code to pause the test execution for 3 seconds using Thread.sleep.
Thread.sleep([1]);Thread.sleep expects time in milliseconds. 3000 ms equals 3 seconds.
Complete the code to create an explicit wait that waits up to 10 seconds.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds([1]));The explicit wait is set to 10 seconds using Duration.ofSeconds(10).
Fix the error in the code to wait until the element with id 'submit' is clickable.
wait.until(ExpectedConditions.[1](By.id("submit")));
To wait until an element is clickable, use ExpectedConditions.elementToBeClickable.
Fill both blanks to create a fluent wait that polls every 2 seconds and ignores NoSuchElementException.
Wait<WebDriver> wait = new FluentWait<>(driver)
.withTimeout(Duration.ofSeconds([1]))
.pollingEvery(Duration.ofSeconds([2]))
.ignoring(NoSuchElementException.class);The fluent wait waits up to 30 seconds and polls every 2 seconds, ignoring NoSuchElementException.
Fill all three blanks to create a stream collector that maps element IDs to their text if text length is greater than 3.
Map<String, String> texts = elements.stream()
.filter(e -> e.getText().length() [1] 3)
.collect(Collectors.toMap(e -> e.getAttribute([2]), e -> e.[3]()));The filter checks if text length is greater than 3, keys are element IDs, and values are element texts.