Last Updated On
Selenium Quiz – You can test your knowledge with this Selenium Quiz. We have created this Selenium WebDriver Quiz Online Test to help you master Selenium.
1. Which of the following browsers supports selenium?.
Select the best answer
- Google Chrome
- Safari
- Mozilla Firefox
- Internet Explorer
- Edge
- All of the above
2. Which selenium component allows to record and playback of the scripts?
Choose one option
- Selenium (IDE)
- Selenium Remote Control
- WebDriver
- Selenium Grid.
3. Which selenium component is used to run tests on different machines against different browsers in parallel?
Choose one option
- Selenium Remote Control
- WebDriver
- Selenium (IDE)
- Selenium Grid
4. Is the findElements method and findElement method both are same in selenium?
Choose one option
- Yes
- No
5. When you only want to access a single element on a web page which method will you use?
Choose one option
- findElement method
- findElements method
- Search
- Submit
6. If the method fails to find the element which of the two methods throws you the exception?
- findElement method
- findElements method
7. Will a findElements type call throw a NoSuchElementException when it can’t find the element?
- Yes
- No
8. Which type of XPath starts with a single forward slash?
Choose one option
- Relative XPath
- Absolute XPath
9. Which exception is shown in selenium when there is a delay in the loading time of the elements with which we are interacting?
Choose one option
- Not Visible Exception
- Element Not Visible Exception
- Load Time Exceeding Exception
10. ‘Following’ axis will find _____
Choose one option
- Only the child and grandchild of the current tag
- All the tags in the DOM after the current node
- All the child tags of the current node
- None
11. ‘Descendant’ axis will fetch __________
Choose one options
- All the child tags of the current node
- All the descendants of the current node including children, grandchildren
- All the tags in the DOM after the current node
12. Consider the below XPath and select the correct meaning
//li[@id='firstItem']//following::a
Choose one option
- Find all the anchor tags and a list item whose id is ‘firstItem’
- Find a list item whose id is ‘firstItem’ and falls after an anchor tag
- Find all the anchor tags in the entire DOM which are falling after the list item whose id is ‘firstItem’
13. Consider the below XPath and select the correct meaning
//li[@id='firstItem']//child::*
Choose one option
- Find all the child nodes (with any tags) of the list item whose id is ‘firstItem’
- Find a list item whose id is ‘firstItem’ and falls after an anchor tag
- Find all the anchor tags in the entire DOM which are falling after the list item whose id is ‘firstItem’
14. Which is not the type of the locators?
Choose one option
- ID
- Link Text
- Type Text
- Name
15. Select the odd one using Selenium
Choose one option
- Pattern Matching
- XPath
- Id
- CSS selector
16. To find the sibling input element that appears after a specific input element in the DOM using XPath, you can use the following XPath expression:
Choose one option
- //input[@id=’your_input_id’]/following-sibling::input
- //input[@id=’your_input_id’]/following-sibling
- //[@id=’your_input_id’]/following-sibling::input
- //input[@id=’your_input_id’]/input
17. What is the JavaScript method used to scroll to a particular Element?
Choose one option
- ((JavascriptExecutor) driver).executeScript(“arguments[0].scrollIntoView(true);”, element);
- ((JavascriptExecutor) driver).executeScript(“arguments.scrollIntoView(true);”, element);
- ((JavascriptExecutor) driver).executeScript(“arguments[0].scrollTo(true);”, element);
- ((JavascriptExecutor) driver).executeScript( element);
18. Running driver.get(“www.google.com”) will:
Choose one option
- Navigates to a page http://www.google.com
- No protocol is specified, so an exception will be thrown
- Navigates to a page https://www.google.com
19. Which is the Supermost interface in Selenium WebDriver?
- WebDriver
- SearchContext
- WebElement
- JavascriptExecutor
20. The color of a WebElement can be found by using the following WebElement method
Choose one option
- getAttribute(“”)
- getTagName()
- getCssValue(“”)
21. Which of the following class is used for dropdown in selenium?
Choose one option
- HTML selects
- Select
- Dropdown
- None
22. Which of the following is the correct syntax to use Select class?
Choose one option
- Select dropdown = new Select(<WebElement>)
- select dropdown = new select(<Element>)
- Select dropdown = Select(<WebElement>)
- None
23. Is it important that the Select class should always start with Capital ‘S’?
Choose one option
- Yes
- No
24. Choose the correct option which selects the option at the given index
Choose one option
- selectIndexes()
- selectByIndex()
- selectByIndexes()
- selectIndex()
25. Select the below navigation methods of WebDriver?
Choose all options
- forward()
- back()
- refresh()
- click()
====================================================================
Answers
1) 6) All of the above
2) 1) Selenium (IDE)
3) 4) Selenium Grid
4) 2) No
5) 1) findElement
6) 1) findElement
7) 2) No. It will not throw an exception. It will return an empty list
8) 2) Absolute XPath
9) 2) Element Not Visible Exception
10) 2) All the tags in the DOM after the current node
11) 2) All the descendants of the current node including children, grandchildren
12) 3) Find all the anchor tags in the entire DOM which are falling after the list item whose id is ‘firstItem’
13) 1) Find all the child nodes (with any tags) of the list item whose id is ‘firstItem’
14) 3) Type Text
15) 1) Pattern Matching
16) 1) //input[@id=’your_input_id’]/following-sibling::input
17) 1) ((JavascriptExecutor) driver).executeScript(“arguments[0].scrollIntoView(true);”, element);
18) 2) No protocol is specified, so an exception will be thrown
19) 2) SearchContext
20) 3) getCssValue(“”)
21) 2) Select
22) 1) Select dropdown = new Select()
23) 1) Yes
24) 2) selectByIndex()
25) 1)forward() 2) back() 3) refresh()