Selenium 3.0 Quiz Questions and Answers

How many types of alerts exist in a web page?

Answer :
  • 3

Identify the valid commands.

Answer :
  • Select se = new Select(driver.findElement(By.xpath( "//*[@id='oldSelectMenu'] ")));

Which of the following command clicks on the 'OK' button of the alert box?

Answer :
  • driver.switchTo( ).alert( ).accept();

Which of the following command clicks on the 'Cancel' button of the alert box?

Answer :
  • driver.switchTo( ).alert( ).dismiss();

Which method captures the message from the alert box?

Answer :
  • driver.switchTo().alert().getText();

Which of the following statements are correct?

Answer :
  • Both a and b

Which method sends data to the alert box?

Answer :
  • driver.switchTo().alert().sendKeys();

What is setScriptTimeout() method in selenium?

Answer :
  • This is used to set the amount of time the WebDriver must wait for an asynchronous script to finish execution before throwing an error.

Which of the following are correct statements?

Answer :
  • Implicit Wait time is applied to all the elements in the script
  • Explicit Wait time is applied only to those elements which are intended by us

Which of the following is an implicit wait command?

Answer :
  • implicitlyWait();