Selenium Multiple Choice Questions Part - 1

1.Which of the following command is used to get all the links present on the page?
a. List <alllinks>=d.findElements(By.xpath("//a"));
b. List alllinks=d.findElement(By.xpath("//a"));
c. List alllinks=d.findElements(By.xpath("//href"));
d. None of the above.

2.Which of the following method in selenium is used to terminate the browser or window/tab which is currently having the focus?
a. quit()
b. close()
c. Both of above
d. None of the above.

3.consider that you want to double click on element or use any key from keyboard using webdriver,Which class will you to use to perform the above operation in selenium?
a. Select class
b. Actions class
c. Both of the above.
d. None of the above.>

4.What will be returned for an Element not found by findElements method in selenium?
a. Return Empty List.    
b. Returns null
c. It doesn't throw any exception.
d. It throws NoSuchElementException.

5.What is default time out time in Selenium IDE ?
a.  30000 ms
b.  20000 ms
c.  10000 ms
d.  None of the above

6.Which is the most efficient way of identifying an element in selenium?
a. ID
b. cssSelector
c. Name
d. Relative Xpath
e. Dynamic Xpath

7.Implicit wait time is applied to all elements in your script and Explicit wait time is applied only for particular specified element.

a. True
b. False

8.The following codes both print: Welcome to QAClick
<title>Welcome to QAClick</title>

1.System.out.println(driver.getTitle()); 2.System.out.println(driver.findElement(By.tagName("title")).getText())
a. True
b. False

9.Which WebDriver method is used to change focus to an alert, a frame or a browser window?
a. changeFocus()
b. setFocus()
c. switchTo()
d. changeTo()

10.Consider the following HTML code snippet

a. The above statement returns 1
b. The above statement returns 3
c. The xpath query is incorrect
d. webdriver statement is incorrect

11.Consider the following code snippet
WebDriverWait wait = new WebDriverWait(driver, 30);
This is an example of an implicit wait.

a. True
b. False

12. In webdriver, which command takes you forward by one page on the browser’s history?
a. navigate.forward()
b. navigate().forward()
c. Navigate.forward()
d. navigate_forward()

13.In webdriver, which of the following commands retrieves the text of a html element?
a. selectText()
b. getText()
c. getElementText()
d. getText(element)

14.In WebDriver, which command can be used to enter values onto text boxes? Select the best answer
a. type()
b. selenium.type()
c. driver.type()
d. sendKeys()
e. sendKeys("text")

15.In webdriver, which methods navigates to a URL?
a. goToUrl("url")
c. getUrl("url")
d. get("url")

16. In webdriver, what is the method that counts the number of elements?
a. driver.getCountOfElements()
b. driver.findElement("search")).getCount()
c. driver.findElements("search")).size()
d. driver.findElements("search")).length()

17.In webdriver, which of the following is a valid select statement that selects a value from a drop down element?
a. selectByIndex()
b. selectByVisibleText()
c. selectByValue()
d. all above
e. none of above

18.Selenium IDE stands for
a.Selenium Intialization Development Environment
b.Selenium Interrelated Development Environment
c.Selenium Information Development Environment
d.Selenium Integrated Development Environment

19.Select the Get command which fetches the inner text of the element that you specify in Web driver Selenium.
a. getinnerText()
b. get_in_Text()
c. get_inner_Text()
d. getText()

20.Which method is used when you want to verify whether a certain check box, radio button, or option in a drop-down box is displayed in Web driver Selenium
a. is_Displayed()
b. isDisplay()
c. isDisplayed()
d. is_Select()

21.Which Component is used to run multiple tests simultaneously in different browsers and platforms?
a. Selenium Grid
b. Selenium IDE
c. Selenium RC
d. Selenium Webdriver

22.On which category below xpath belongs to?

a. Relative Xpath
b. Absolute Xpath
c. Linear Xpath
d. None of these

23.Which statement is used to maximise browser window
a. driver.manage().window().maximize();
b. driver.manage().maximize();
c. driver.maximize()
d. None of Options

24._________________ is used to enter text in text box in Selenium WebDriver
a. sendKey()
b. submit()
c. sendKeys("text")
d. selectAll("Text")

25. In Cron Pattern 3rd Parameter is for
a. Day of Month
b. Day of Week
c. Minute
d. Month of Year

For Answers Click Here