These Selenium Automation multiple-choice questions and their answers will help you strengthen your grip on the subject of Selenium Automation. You can prepare for an upcoming exam or job interview with these 90+ Selenium Automation MCQs.
So scroll down and start answering.
A. selenium.webdriver.support.e xpected_conditions.new_window_is_opened(current_handles)
B. selenium.webdriver.supporLexpected_conditions.number_of_windows_to_be(num_windows)
C. None selenium.webdriver.support.expected_conditions.frame_to_be_available_and_switch_to_it(locator)
A. lldiv[contains(@id,‘time_')]
B. lldiv[contains(@id_time())]
C. l/div[parameter(@id_time())]
D. l/div[parameter(@id,'time_')]
A. selectVisibleText
B. selectByVisibleText
C. select_VisibleText
D. select_ByVisibleText()
A. javax.servlet.http.HttpServlet
B. org.openqa.grid.web.servlet.RegistryBasedServlet
C. Either option a or b could be used.
A. driver.manage0.imp|icitlyWait.timeouts(15,TimeUnitSECONDS);
B. driver.manage0.timeoutso.implicitlyWait(15.TimeUnit.SECONDS);
C. implicitlyWait.timeouts(15).driver.manageo;
D. implicitlyWait.driver.manage(timeouts (T imeUnitSECONDS, 15));
A. None
B. call select_by_visible_text(text)
C. call select_by_value(value)
D. call select_by_index(index)
A. driver.switchT00.window("windowName");
B. driver.switchTo(window("windowName"));
C. driver.switchTo().window.windowNarne;
D. driver.window.switchToO.windowName;
A. TRUE
B. FALSE
A. netstat -at
B. netstat -a
C. netstat -u
D. netstat —|
A. java -jar grid.selenium-server-standalone-2.44.0.jar -role hub
B. java -jar selenium-server—standalone-2.44.0.jar -role hub
C. java -jar hub-grid~selenium-server-standalone-2.44.0.jar -role
D. java -jar hub-selenium-server-standalone-2.44.0.jar -role
A. None of these.
B. getWindowHandlesO returns handles of all the open browsers whereas getWindowHandleo gets the address of the current browser.
C. getWindowI-landleso returns the active browser handle whereas getWindowI-Iandleo gives the top most browser handle.
D. getWindowI-landleso returns a String whereas getWindowI-landleo returns an lterator
A. VerifyElementPresent
B. lsElementExist
C. lsElementPresent
D. verifyTextPresent
A. VerifyTextPresent and assertTextPresent
B. VerinylementPresent and assertElementPresent
C. VerifyAlertPresent and assertAlertPresent
D. VerifyAlert and assertAlert
A. selenium.webdriver.support.expected_conditions.title_is(title)
B. seleniumwebdrivensupport.expected_conditions.text_to_be_present_in__element_value(locator, text_)
C. None
D. selenium.webdriver.support.expected_conditions.title_contains(title)
Consider the element given below.
Which of the following Java commands will be used for locating the above element in WebDriver?
A.
WebElement element = WebElemenLfindElement.by.id("exampleDiv");
B.
WebElement element = driver.element.find.id(“exampleDiv"));
C.
WebElement element = driver.findElement(By.id("exampleDiv"));
D.
WebElement element = WebElemeanindElementid("exampleDiv");
A. selenium.webdriver.supportexpected_conditions.presence_of_element_located(locator)
B. selenium.webdriver.support.expected_condltions.staleness_of(element)
C. selenium.webdrivensupportexpected_conditions.presence_of_a|l_eIements_located(locator)
D. None
A.
WebDriverWait exampleWait = new WebDriverWait (15, TimeUnitSECONDS);
ExpectedConditions.exampleWait.until.titleContains("Learning Selenium");
B.
WebDriverWait exampleWait = new WebDriverWait (T imeUnit.SECONDS, 15);
ExpectedConditions.until.titleContains. exampleWait("Learning Selenium");
C.
WebDriverWait exampleWait = new WebDriverWait (15, driver);
exampleWait.until(ExpectedConditions.title.contains("Learning Selenium"));
D.
WebDriverWait exampleWait = new WebDriverWait (driver, 15);
exampleWait.until(ExpectedConditions.titleContains("Learning Selenium"));
A. driver.get0.backward0;
B. driver.get(back);
C. driver.navigate(back);
D. driver.navigate().back();
A. new WebDriverWait(10).get(ExpectedCondtions.alertlsPresentO);
B. new WebDriverWait(ExpectedCondtions.alertlsPresent(10));
C. new WebDriverWait0.wait(ExpectedCondtions.alertlsPresent(driver, 10));
D. new WebDriverWait(driver. 10).untiI(ExpectedCondtions.alertlsPresent0);
A. Using element's ID
B. By a link's text
C. Using an XPath statement
D. Using document Object model (DOM)
A. sendKeys(Keys.T' AB) == sendKeys("\uE004“)
B. sendKeys(Keys.F5) = sendKeys("\uEO35")
C. sendKeys(Keys.PAGE_DOWN) == sendKeys(AuEOOF")
D. sendKeys(KeysARROW_DOWN) = sendKeys("\uE015")
E. sendKeys(Keys.ENTER) = sendKeys("\u EO0A")
F. sendKeys(Keys.SPACE) = sendKeys(“\uEOOD”)
A. initElements.PageFactoryO;
B. PageFactory.initialize();
C. PageFactory.initElements();
D. initialize.PageFactory();
A. click()
B. beforeClickOn
C. contextClick
D. None of these
A. java -selenium—server—standalone-2.44.0.jar hub -node 4441.port
B. java -selenium-server-standalone-2.44.0.jar snode- role hub —add -port 4441
C. java -jar selenium-server-standalone-2.44.0.jar -role hub -port 4441
D. java -jar selenium-server—standalone-2.44.0.jar -role hub 4441-port
A. java -jar selenium-server-standalone-2.44.0.jar -h
B. java -jar selenium-server-standalone-2.44.0.jar -help
C. java ~jar selenium-server—standalone-2.44.0.jar -role node -h
D. java -jar selenium-server-standalone-2.44.0.jar -role -help -node
A. Selenium WebDriver does not support this functionality
B. Using the Actions class‘ method moveToElement (element, xOffset, yOffset)
C. Using the Actions class' method moveToElement ( xOffset. yOffset)
D. Using the Actions class' method moveToElement ( xOffset. yOffset. element)
A. verifyTextPresent
B. verinylementPresent
C. verifyText
D. Either option a or b could be used
A. HtmlUnit Driver
B. Firefox Driver
C. Internet Explorer Driver
D. Both options a and b
What does the below lines of code meant for?
WebDriver driver = new FirefoxDriverO;
Selenium selenium = new WebDriverBackedSelenium(driver,
"http://www.techbeamers.com/");
A.
Will simply start the browser and open the site.
B.
Will run Selenium 1.0 tests in webdriver.
C.
None of these.
D.
Will run webdriver tests using selenium.
A. Alert
B. Wait
C. TargetLocator
Choose True or False.
While running tests with RemoteWebDriver or Selenium-Grid. you can take screenshots.
A.
True
B.
False
A. Actions builder = new Actionso; doubleClick.builder.message.perform();
B. Actions builder = new Actions(driver); builder.doubleClickfmessage).perform0;
C. Actions driver = new Actions(builder); builder.doubleClick.perform0;
D. Actions driver = new Actions(builder); builder.doubleClick.perform(message);
In Order to mouse hover on a web element using WebDriver? Is the below written code uses the correct syntax and code
// lnstantiating Action Interface
Actions actions=new Actions(driver);
ll howering on the dropdown
actionsmoveToElement(driver.findElement(By.id("id of the dropdown"))).perform();
// Clicking on one of the items in the list options
WebElernent subLinkOption=driver.findElement(By.id("id of the sub |ink"));
subLinkOption.click();
A.
TRUE
B. False
A. None
B. import selenium.common.exceptions
C. import selenium.common.exceptions.TimeoutException
D. from selenium.common.exceptions import TimeoutException
A. Implicit Wait
B. Explicit Wait
A. switchTol)
B. changeFocus
C. changeTo
D. setFocuso
A. The waitForElementPresent command pauses an execution until an expected new page loads. This method is automatically called whenever clickAndWait is used.
B. The assertTitle command verifies an expected page title.
C. The open command is used for opening a page using URL.
D. The verifyTable command verifies the expected contents of a table.
A. driver.alert().accepto;
B. driver.switchTo().alert0.accept0;
C. driver.get0.alert0.accept0;
D. driver.switchT00.get0.alert0.accept0;
Select the correct the WebDriver methods to manage web-based alerts?
1.dismiss()
2.accept0
3.ignore()
4.sendKeys(String stringToSend)
5.getText()
A.
1,2 & 5
B.
3.5 &1
C.
All of the Above
D.
1,2,4 & s
A. is_Selected0
B. isSelect()
C. isSelected()
D. is_Select()
A. elementToBeSelected (WebElement element)
B. presenceOfElementLocated (By locator)
C. elementToBeClickable(By locator)
D. titleContains
A. driver.switchT00.frarne()
B. drivenfindElement
C. drivenswitchToO.defaultContent
D. driver.switchTo().window0
A. getConfirmation
B. verifyConfirmation
C. waitForConfirmation
D. assertConfirmation
A. verify
B. assert
C. wait
D. Either option a or b can be used
A. java -cp ':. org.openqa.grid.selenium.GridLauncher -role node -hub -servlets org.abc.mydemo.AllNodes
B. java -cp ‘:.java - selenium-server-standalone-2.44.0.jar -role node http://localhostz4444 lgrid/register -servlets org.abc.mydemo.AllNodes
C. java -cp ':.java - selenium-server-standalone-2.44.0.jar -ro|e node - org.abc.mydemo.AllNodes -servlets
D. java -cp ”:. org.openqa.grid.selenium.GridLauncher -role node -hub http://localhost:4444 lgrid/register -servIets org.abc.mydemo.AllNodes
Which of the following is the correct path for accessing all the servlets added to the node running on port 5555?
Consider abc as the machine name or ip on which the node is running.
A.
http://abc:5555/extra/
B.
http://abc:5555/admin/extra/
C.
http://abc:5555/admin/
D.
http://555528bc/admin/
Which of the following is/are the correct reason(s) for using Selenium-Grid?
i) For running tests against multiple browsers.
ii) For running tests against browsers running on different operating systems.
iii) For reducing the time taken by the test suite to complete a test pass.
iv) For running the test using Internet Explorer Driver on Mac OS or Unix.
v) For running tests with slow speed.
A.
Only option iii)
B.
Only options i), ii) and iii)
C.
Only options i), iii) and iv)
D.
Only options iii), iv) and v)
A. It‘s the time duration to wait for a test suite to finish its execution.
B. It's the time duration to wait for a test group to finish its execution.
C. It‘s the time duration to wait for a test to finish its execution.
D. None of the above
A. It should be upper-cased
B. It should be lower-cased
C. It can be case insensitive
A. One
B. Two
C. Three
D. Four