Selenium Interview Questions

lella keerthi
4 min readAug 19, 2021

--

1. How many languages does Selenium support?

Ans. Selenium support various programming languages such as C#, Java, PHP, Ruby, Python, Perl, Javascript, etc.

2. What is automation testing?

Ans. Automation testing or Test Automation is a process of automating the manual process to test the application/system under test. know more at Selenium online training

Automated Testing Process:

Follow the given steps for automation testing:

  1. Test Tool Selection
  2. Define Scope of Automation
  3. Planning, Design and Development
  4. Test Execution
  5. Maintenance

Q3. What are the different ways to find an element?

Ans. Following are the different ways to find an element:

  • ID
  • Name
  • Tag
  • Attribute
  • CSS
  • Linktext
  • PartialLink Text
  • X-path

Q4. What are the testing types supported by Selenium?

Ans. Following are the testing types supported by Selenium:

  • Functional Testing
  • Regression Testing
  • Sanity Testing
  • Smoke Testing
  • Responsive Testing
  • Cross Browser Testing
  • UI testing (black box)
  • Integration Testing

Q5. What is the difference between implicit wait and explicit wait in selenium WebDriver?

Ans. When an implicit wait is implemented in tests, if WebDriver cannot find an element in the Document Object Model (DOM), it will wait for a defined amount of time for the element to appear in the DOM. know more at Selenium training

An explicit wait can be used where synchronization is needed, for example, the page is loaded but we are still waiting for a call to complete and an element to appear.

Q6. Which is better — implicit wait or explicit wait?

Ans. Explicit waits are better than implicit wait. Unlike an implicit wait, you can write custom code or conditions for wait before proceeding further in the code.

Q7. When should I use Selenium IDE?

Ans. Selenium IDE is the simplest of all the tools in the package and should be a great tool for naïve users as it is easy to learn with minimal acquaintances in the programming language.

Q8. Explain the difference between single (/) and a double slash (//) in X-path?

Ans. Single slash (/) allows the creation of ‘absolute’ path expressions, while double slash (//) allows the creation of ‘relative’ path expressions.

Q9. What is the use of XPath?

Ans. XPath is used to find the WebElement in web pages. It is also useful in identifying the dynamic elements. know more at Selenium online course

Syntax:

Xpath=//tagname[@attribute=’value’]

  • //: To select current node
  • Tagname: Tagname of the given node
  • @: To select attribute
  • Attribute: Attribute name of the node
  • Value: Value of the attribute

Q10. What is the difference between type keys and type commands?

Ans. Type key populates the value attribute using JavaScript whereas type commands emulate like actual user typing.

11. What is the difference between verify and assert commands?

Ans. Assert command allows us to check whether an element is on the page or not. Verify command checks whether the element is on the page, otherwise, the test will carry on executing.

Q12. What are heightened privilege browsers?

Ans. Heightened privileges browsers are similar to Proxy Injection, allowing websites to do something that is not commonly permitted. know more at selenium online training in hyderabad

Q13. Explain what is Data-driven framework and Keyword driven?

Ans. In a Data-driven framework, the test data is separated and kept outside the Test Scripts, while test case logic resides in Test Scripts.

Keyword-driven frameworks require the development of data tables and keywords, independent of the test automation.

Q14. What is Object Repository?

Ans. Object repository is an essential entity in any UI automation which allows a tester to store all object that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.

Q15. Mention 5 different exceptions you had in Selenium WebDriver?

Ans. The 5 different exceptions in Selenium WebDriver are WebDriver Exception, NoAlertPresentException, NoSuchWindowException, NoSuchElementException, TimeoutException

Q16. Which web driver implementation is the fastest?

Ans. HTMLUnit Driver implementation is the fastest

Q17. How to find more than one web element in the list?

Ans. It can be done using WebElement List. E.g.

18. What is the difference between driver.close() and driver.quit() command?

Ans. Close() method closes the web browser window that the user is currently working on or the browser that WebDriver is currently accessing. know more at best selenium online training

Quit() method closes down all the windows that the program has opened.

Q19. In which format does the source view show your script in Selenium IDE?

Ans. XML

Q20. What is Object Repository? How can we create an Object Repository in Selenium?

Ans. Object Repository is a term used to refer to the collection of web elements belonging to Application Under Test (AUT) along with their locator values.

In Selenium, objects can be stored in an excel sheet that can be populated inside the script whenever required.

Q21. Explain how to navigate to a new window from the current window?

Ans. To navigate to a new window from the current window, you can use:

driver.navigate().to(new window url) method

Q22. How can you convert any Selenium IDE tests from Selenese to another language?

Ans. The format option of Selenium IDE to convert tests into another programming language

Q23. To generate pdf reports, what Java API is required?

Ans. API IText

Q24. What are the ways you can customize the TestNG report?’

Ans. You can customize TestNG report in two ways:

  • Using ITestListener Interface
  • Using IReporter Interface

Q25. In Selenium, what are Breakpoints and Startpoints?

Ans. A breakpoint is implemented to stop execution to check if the code is working as expected till now. know more at Selenium training course

A startpoint indicates the point from where the execution should begin.

--

--

No responses yet