Selenium Interview Questions
Master common Selenium WebDriver interview questions from basic to advanced level.
Q1: What is Selenium WebDriver?
Answer: Selenium WebDriver is a web automation framework that allows you to execute tests across different browsers. It provides a programming interface to create and execute test scripts. WebDriver directly communicates with the browser without any intermediary server and controls the browser by directly communicating with it.
Q2: What are the different types of locators in Selenium?
Answer: Selenium supports the following locators:
- ID
- Name
- Class Name
- Tag Name
- Link Text
- Partial Link Text
- CSS Selector
- XPath
Q3: What is the difference between findElement() and findElements()?
Answer: findElement() returns the first matching element on the page and throws NoSuchElementException if no element is found. findElements() returns a list of all matching elements and returns an empty list if no elements are found.