Complete the code to initialize the WebDriver for Chrome browser.
WebDriver driver = new [1]();The ChromeDriver class initializes the WebDriver for Chrome browser, which is commonly used in Selenium tests.
Complete the code to wait explicitly for an element to be visible.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); wait.[1](ExpectedConditions.visibilityOfElementLocated(By.id("submitBtn")));
The until method waits until the given condition is true, here waiting for visibility of the element.
Fix the error in the test method annotation to enable test execution.
@[1]
public void testLogin() {
// test steps
}The correct JUnit 5 annotation to mark a test method is @Test with capital 'T'.
Fill both blanks to create a Page Object method that clicks a button by locator.
public void clickButton() {
driver.findElement([1]).[2]();
}The method findElement needs a locator like By.id("submitBtn"), and to click the button we use the click() method.
Fill all three blanks to create a test that asserts page title equals expected.
String title = driver.[1](); String expected = "Home Page"; assert[2](expected, title, "Title should match"); System.out.println("Page title is: " + [3]);
The getTitle() method gets the page title. The assertion method is assertEquals to compare expected and actual. Finally, print the title variable.