Complete the code to click on the button element.
WebElement button = driver.findElement(By.id("submitBtn")); button.[1]();
The click() method is used to perform a click action on a web element like a button.
Complete the code to click on a link using its visible text.
driver.findElement(By.linkText("[1]")) .click();
The By.linkText() locator finds a link by its visible text. Here, "Home" is the link text to click.
Fix the error in the code to correctly click on a button using XPath.
driver.findElement(By.xpath("//button[@id='[1]']")) .click();
The XPath expression must have the attribute value properly quoted. Using 'submitBtn' inside double quotes is correct.
Fill both blanks to wait until the button is clickable, then click it.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); wait.[1](ExpectedConditions.[2](By.id("submitBtn"))).click();
The until() method waits for a condition. The condition elementToBeClickable() waits for the element to be clickable before clicking.
Fill all three blanks to perform a click using Actions class on a button with id 'submitBtn'.
Actions actions = new Actions(driver); actions.[1](driver.findElement(By.[2]("[3]"))).perform();
The click() method of the Actions class is used to perform a click action on the web element located by id with value submitBtn.