Complete the code to find an element by its class name.
WebElement element = driver.findElement(By.[1]("button-primary"));
The findElement method uses By.className to locate elements by their class attribute.
Complete the code to click on the element found by class name.
driver.findElement(By.className("submit-btn")).[1]();
After finding the element by class name, calling click() performs a click action on it.
Fix the error in the code to correctly find an element by class name.
WebElement element = driver.findElement(By.[1]("main-content"));
The correct method name is className with camel case. Other variants cause errors.
Fill both blanks to find an element by class name and get its text.
String text = driver.findElement(By.[1]("header-title")).[2]();
Use className to find the element and getText() to get its visible text.
Fill all three blanks to find an element by class name, check if it is displayed, and print the result.
WebElement element = driver.findElement(By.[1]("nav-menu")); boolean visible = element.[2](); System.out.println("Is visible: " + [3]);
Find the element by className, check visibility with isDisplayed(), and print the boolean variable visible.