Complete the code to create a WebDriver instance using a utility class method.
WebDriver driver = UtilityClass.[1]();The utility class method getDriver() is commonly used to return a WebDriver instance.
Complete the code to wait for an element to be visible using the utility class.
UtilityClass.[1](driver, By.id("submitBtn"), 10);
The method waitForVisibility waits until the element is visible on the page.
Fix the error in the utility method call to take a screenshot.
UtilityClass.[1](driver, "error.png");
The correct method name is takeScreenshot with a lowercase 's' in 'shot'.
Fill both blanks to create a utility method that returns a list of WebElements by CSS selector.
public static List<WebElement> [1](WebDriver driver, String selector) { return driver.findElements(By.[2](selector)); }
The method getElementsByCss is a utility method name, and cssSelector is the correct By method to find elements by CSS selector.
Fill all three blanks to implement a utility method that waits for an element to be clickable and then clicks it.
public static void [1](WebDriver driver, By locator, int timeout) { WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds([2])); WebElement element = wait.until(ExpectedConditions.[3](locator)); element.click(); }
The method clickWhenReady describes clicking when ready, timeout is the variable for seconds, and elementToBeClickable is the ExpectedConditions method to wait for clickability.