Complete the code to open the browser and navigate to the homepage URL.
WebDriver driver = new ChromeDriver(); driver.[1]("https://example.com");
The get method loads a new web page in the current browser window.
Complete the code to click a link that navigates to the next page.
WebElement nextPageLink = driver.findElement(By.id("nextPage")); nextPageLink.[1]();
The click method simulates a mouse click on the element, triggering navigation.
Fix the error in waiting for the next page to load by completing the wait condition.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); wait.until(ExpectedConditions.[1](By.id("pageTitle")));
Waiting for visibility ensures the element is present and visible before continuing.
Fill both blanks to navigate back to the previous page and verify the title.
driver.[1](); String title = driver.[2](); assertEquals("Home Page", title);
navigate().back() goes back one page. getTitle() returns the page title string.
Fill all three blanks to extract text from an element, verify it, and then close the browser.
WebElement message = driver.findElement(By.cssSelector(".alert-success")); String text = message.[1](); assertTrue(text.[2]("Success")); driver.[3]();
getText() gets the element's text. contains("Success") checks if text includes 'Success'. quit() closes the browser.