Selenium Interview Questions With Answers – Basic & Advanced

Selenium interview questions
 

What is Selenium? Developed by Jason Huggins in 2004, it came into existence when Huggins was working on an app that needed immense manual testing. He designed a JavaScript code capable of automating browser control to combat this. It simplified the testing process and was known as the Selenium Remote Control.

 

Later the same year, it was open-sourced. Now, Selenium is an open-source automation testing tool that automates web browsers and allows test web-based applications. It is not one tool but a combination of many.

 

Jump To

 

With Selenium, you get one interface, which helps you write in programming languages like Perl, NodeJS, Ruby, C#, Python, Java, PHP, etc. Execution speed and performance in Selenium are a lot better than all the other similar tools in the market.

 

Selenium Types or Components

Selenium has four components:

  • Selenium Integrated Development Environment (IDE)
  • Selenium Remote Control (RC)
  • WebDriver
  • Selenium Grid

Each component serves a different purpose – parallel test capabilities, multiple browsers support, execution on multiple machines, etc.

 

Can I Learn Selenium In 10 Days?

The period you take to learn Selenium depends on your availability, interest, and time spent learning the topic. However, to be well versed in selenium, 10 days is a bit too tight. Typically, you can learn Selenium from scratch to an advanced level in about four to five weeks.

 

How?

Below, we will enlist the method to make this happen:

 

  • Before you start learning Selenium, you need some base. So, you will have to learn a programming language to write automation scripts. We recommend using Java because it is one of the most widely used programming languages.
  • Now, start understanding the Java fundamentals like exceptions, OOPS concepts, and basic level threading. All of this can take about a week.
  • In addition, you also must have clarity on JavaScript, CSS, and HTML fundamentals. It can speed up the process and help you understand web applications. All of this can take about three days.
  • Now, start developing a basic java program. It should cover all of your learned concepts. You can spare two days for this.
  • Now, go through Selenium tutorials and certifications, and try to understand:
  • What is Selenium?
  • How web driver came into existence
  • You can complete this in a day and move forward.
  • Now, download Selenium IDE, and get exploring it. It is a pretty elementary tool and can give you a good foundation for the Selenium. You can dedicate two days to it.
  • Now, download the web driver, and begin making automation scripts for web apps. You can make several scripts to acquire more experience. Ideally, dedicate five days to this.
  • You can now enable all the scripts to run on different browsers for the next two days.
  • Further, develop your framework, which reads locators and data from excel files. You can build the keyword-driven framework in four days, the data-driven framework in the next four days, and then plug them together to design a hybrid framework in another four days.

 

With that, you must have learned Selenium.

Now that you know Selenium, it is vital to make it a bankable skill. For this, you need to get a job in the field. But, to get hired, you need to pass through several Selenium technical interview questions and answers.

 

Also, you will not be the only person answering these Selenium interview questions for experienced and freshers jobs. There will be stiff competition. Hence, prepare better.

 

We have come up with 100 frequently-asked Selenium interview questions and answers that we will discuss below. Here, you will find some basic and advanced Selenium questions. So, regardless of the level, you apply for, these prep questions can prove beneficial.

 

Selenium Interview Questions With Answers That You Must Prepare

A.  Selenium Basic Interview Questions

Let us start with some basic Selenium questions.

 

Ques 1. What is automation testing?

It is one of the most commonly asked question. You have to be straightforward in your approach to answer this question. So, as a response, you can say:

 

Ans. Automation testing or test automation is a medium of automating the manual process to check the system or app under test. In this, you employ a separate testing tool to create test scripts for repeat execution. Automation testing needs no manual intervention.

 

Ques 2. What, according to you, are some Selenium testing limitations?

It is one of the more common Selenium basic interview questions. You may find such Selenium interview questions for experienced and fresher placements both.

Ans. Some primary limitations of Selenium testing include:

  • Selenium is an open-source tool. Hence, there is no reliable, dedicated tech support to handle user queries.
  • There is a lack of proper support for image testing.
  • Selenium has to be integrated with third-party tools like TestNG and Appium for testing mobile and web apps.
  • You cannot use the Selenium WebDriver without having basic programming language knowledge.
  • There is no in-built test management and reporting facility. So, integrate it with Junit or TestNG to allow test management and reporting.

 

Ques 3. Point out the pros of automated testing.

Almost all interviews will have this as one of the Selenium basic interview questions. You have to be thorough with this if you wish to ace the Selenium technical interview questions and answers round.

Ans. Some key benefits of automated testing include:

  • It allows parallel execution of the test cases.
  • It supports the system or the app’s functional and performance testing.
  • It lets you test a large-scale test matrix.
  • It saves the testing team time and money.
  • It amplifies the system’s efficiency and accuracy by lowering manual intervention to yield test results.
  • It allows the rapid execution of repeat test cases.

 

Ques 4. Mention the benefits of Selenium.

You cannot avoid these selenium interview questions and answers if you apply for a job.

Some main benefits of Selenium include:

  • It allows multi-browser testing.
  • It is free to use and needs no licensing costs.
  • Selenium IDE lets non-programmers write automation codes.
  • It supports several languages like Python, Ruby, Java, etc.
  • They have a vast helping community and resources over the internet.
  • Selenium Grid allows distributed testing on remote machines.

 

Ques 5. Is Selenium 2.0 different from Selenium 3.0?

Ans. Selenium RC is the Selenium 2.0, and the integration of WebDriver and Selenium RC in one tool is the Selenium 3.0.

 

B. Selenium Interview Questions and Answers For Freshers

Now, let us address a few selenium interview questions with answers for freshers.

 

Ques 6. What is Selenium composed of?

These are not selenium advanced interview questions, so be prepared to answer it if you are a fresher appearing for an interview.

 

Ans. Selenium is a collection of tools to streamline automated web testing. It is composed of:

  • Selenium Integrated Development Environment (IDE) is a Firefox plugin for recording and playback.
  • Selenium Remote Control (RC) and WebDriver offer APIs for several languages like PHP, .NET, Java, etc.
  • Selenium Grid lets you distribute the tests on different machines for parallel functioning. Hence, the grid reduces the time needed for performing browser test suites.

 

Ques 7. Which drivers or browsers are supported by the Selenium web driver?

Are you appearing for the fresher interview? It is one of the most common selenium interview questions and answers.

Ans. Some of the most prevalently used browsers supported by Selenium are:

  • Internet Explorer – InternetExplorerDriver
  • iOS – iOS-driver/Appium
  • Google Chrome – ChromeDriver
  • HtmlUnit (Headless browser) – HtmlUnitDriver
  • Firefox – FireFoxDriver
  • Android – Selendroid/Appium
  • Safari – SafariDriver

 

Ques 8. State some of the commonly used Automation Tools for Functional Automation.

Ans. A few tools employed for functional automation include:

  • Telerik Test Studio, Developed by Telerik.
  • TestingWhiz
  • HPE Unified Functional Testing (HP – UFT formerly QTP)
  • Tosca Testsuite
  • Watir
  • Quick Test Professional, provided by HP.
  • Rational Robot, provided by IBM.
  • Coded UI, provided by Microsoft.
  • Selenium, open-source.
  • Auto It, Open Source.

 

Ques 9. What is SDLC?

It is one of the most common selenium technical interview questions and answers.

Ans. SDLC refers to the Software Development Life System. It is the most crucial aspect of the testing.

 

Ques 10. What are the two types of testing?

Ans. The two kinds of testing are:

  • Automation testing offers a medium to automate the testing process. It is in high demand.
  • Manual testing involves the physical execution of test case scenarios to find bugs and errors.

 

C. Selenium Advanced Interview Questions

We have already discussed some Selenium basic interview questions. Now, let us move forward and list a few tough selenium interview questions and answers.

 

Ques 11. Point out the popular tools for automation testing.

Such advanced questions are common in selenium interview questions for experienced.

Ans. Your answer should be:

  • Selenium
  • Rational Robot
  • HP Unified Functional Testing (UFT)
  • IBM Rational Functional Tester

 

Ques 12. Mention some test cases that can be automated.

Ans. Some test cases that can be automated include:

  • Data-driven test cases
  • Test cases with higher complexity
  • Test case with many database updates
  • The test execution rate is high
  • Smoke/Critical tests
  • Tests with several combinations
  • Graph test cases
  • Higher manual execution time

 

Ques 13. Also, mention some test cases that cannot be automated.

It is another one of the most common selenium advanced interview questions.

Ans. Tests that cannot be automated are:

  • Subjective Validation
  • New Functionalities
  • Strategic Development
  • User Experience
  • Complex Functionality
  • Quality Control
  • Low return on investment
  • Installation and setup testing

 

Ques 14. What are the different exceptions in Selenium WebDriver?

Ans. Broadly, exceptions in Selenium WebDriver are the same as those in other programming languages. These are:

  • TimeoutException
  • ElementNotVisibleException
  • NoSuchElementException
  • StaleElementException

 

Ques 15. What are the different types of locators in Selenium?

Ans. Some locators in Selenium are:

  • ClassName
  • CSS Selector
  • DOM
  • ID
  • Link Text
  • Name
  • PartialLinkText
  • TagName
  • XPath

 

D. Selenium Interview Questions For Experienced

Ques 16. How many test cases have you automated per day?

The response to these selenium interview questions and answers depends on test case length and complexity.

If the complexity is high, even one test scenario per day suffices. However, you can say two to five test scenarios in a day for simpler ones.

 

Ques 17. What is the latest version of Selenium?

Ans. Selenium 4.0.0 Alpha 5. It came out in March 2020.

 

Ques 18. What is new in Selenium 4.0?

Ans. Selenium 4.0 includes:

  • W3C WebDriver Standardization
  • Selenium 4 IDE TNG
  • Refreshed Documentation
  • Improved Selenium Grid
  • Better Window and Tab management
  • Relative locators

 

Ques 19. Name the only browser that supports Selenium IDE.

Ans. Firefox.

 

Ques 20. Write the Selenium Command to fetch the Current Page URL?

Ans. webdriver.getCurrentUrl();

 

Bonus Selenium Technical Interview Questions and Answers

Ques 21. What is the syntax to launch the browser in Selenium WebDriver?

Ques 22. What is a Framework?

Ques 23. How can you find if an element is displayed on the screen?

Ques 24. What Is The Difference Between “xrange” And “range”?

Ques 25. What is slicing?

Ques 26. How to assert the title of the web page in WebDriver?

Ques 27. What are vital Web/HTML Elements?

Ques 28. Write code for Action class

Ques 29. How will you generate Reports?

Ques 30. What is Selenese?

Ques 31. What is the difference between driver.close() and driver.quit() Selenium WebDriver?

Ques 32. What are some noteworthy Selenium 4 features?

Ques 33. What is the difference between Selenium and QTP?

Ques 34. What’s the difference between soft and hard asserts?

Ques 35. How to validate any error/success message in Selenium WebDriver?

Ques 36. State the commands to download Selenium.

Ques 37. How can tests be debugged in Selenium IDE?

Ques 38. How would you take a screenshot with Selenium Webdriver?

Ques 39. State the difference between verify and assert commands.

Ques 40. What are the Open-source Frameworks supported by Selenium WebDriver?

Ques 41. How to check whether the text is present/visible or not on the page?

Ques 42. Is there a way to type in a textbox without using sendKeys()?

Ques 43. How to access the CSS selector using the nth element?

Ques 44. What is a Module-Based Testing Framework?

Ques 45. What is the syntax for the implicit, explicit, and fluent wait?

Ques 46. What are the various waits in Selenium WebDriver?

Ques 47. Can an image or captcha be automated with Selenium?

Ques 48. What is Page Factory?

Ques 49. What is a locator?

Ques 50. How Web Driver is an interface?

Ques 51. What about Selenium Certification?

Ques 52. How to find more than one element in the list?

Ques 53. What is RemoteWebDriver?

Ques 54. What are the Prerequisites for writing Selenium Test Cases?

Ques 55. How to initialize the Chrome driver?

Ques 56. What is a soft assertion and a hard assertion in Selenium?

Ques 57. What are the different states of a browser?

Ques 58. What’s Junit?

Ques 59. Is FirefoxDriver a class or an interface?

Ques 60. What is the difference between a Page Factory and Page Object Model (POM)?

Ques 61. How to handle web-based pop-ups?

Ques 62. How to scroll vertically and horizontally using Selenium WebDriver?

Ques 63. What are all the locators that support Selenium?

Ques 64. What is Parameterization in TestNG?

Ques 65. Write code for handling Frames

Ques 66. Why is the main() method public, static, and void in Java?

Ques 67. How can you send text input to a focused element?

Ques 68. Which is the slowest locator?

Ques 69. Which is the best locator?

Ques 70. What are switch classes in Selenium?

Ques 71. What is the difference between “/” and “//”?

Ques 72. How to read test data from Excel?

Ques 73. What is the use of Xpath?

Ques 74. Consider a situation: Selenium Script runs in Chrome but not in IE. How can you resolve the issue?

Ques 75. What are window handles?

Ques 76. What is the Silk Test tool?

Ques 77. What is the difference between HTMLUnitDriver and FirefoxDriver?

Ques 78. What is the difference between the close() and quit() func of the browser?

Ques 79. Can we do data-driven testing using Selenium?

Ques 80. What is the importance of the ‘finally’ block in Java?

Ques 81. What are the different locators to search an element with Selenium?

Ques 82. How to find broken links in Selenium?

Ques 83. What are the advantages of Maven integration with Selenium?

Ques 84. Write code for Cross Browser Testing

Ques 85. Which is the package you import while working with WebDriver?

Ques 86. How do you handle and switch between browser windows?

Ques 87. List different JUnit annotations.

Ques 88. How to skip a method or a code block in TestNG?

Ques 89. How to send the ALT/SHIFT/CONTROL key in Selenium WebDriver?

Ques 90. Mention any five uses of JavaScriptExecutor in elenium.

Ques 91. What was the ROI of Test Automation?

Ques 92. How to get all the options in a Dropdown?

Ques 93. Write test cases for a scenario – eg. entering the address

Ques 94. How to upload a file in Selenium WebDriver?

Ques 95. What are the different Navigation commands in Selenium?

Ques 96. How can you insert a document into another document?

Ques 97. What is POM? List its advantages?

Ques 98. Explain STLC.

Ques 99. Explain SDLC.

Ques 100. What is a relative path?

 

FAQs About Selenium

Ques 1. What are four parameters in Selenium?

Ans. There are four conditions (parameters) for Selenium to pass a test – URL, host, browser, and port number.

 

Ques 2. Is Selenium a tool or API?

Ans. Selenium is an open-source tool and an API.

 

Ques 3. What is TestNG in Selenium?

Ans. It is a Java testing framework inspired by JUnit and NUnit.

 

Ques 4. What is the primary use of Selenium?

Ans. It is an open-source tool, which automates web browsers, and offers one interface to write test scripts in programming languages.

 

Ques 5. What can be tested automatically using Selenium?

Ans. Selenium can test web applications automatically.

 

Ques 6. What are the Java questions asked in the Selenium interview?

Ans. In a Selenium interview, you can find Java Questions on the following topics:

  • OOPS Concept
  • List of keywords, Interface in Java
  • Handle data types and usage of the same
  • Control statements
  • Looping statements
  • String class, Wrapper classes, Array (2 D arrays)
  • Exception handling
  • Collection framework (List, Set, MAP)

 

Ques 7. What are the challenges faced in Selenium automation testing interview questions?

Ans. Some challenges experienced in Selenium Automation include:

  • Cross Browser Testing
  • Scalability
  • Synchronizing Events
  • Handling Dynamic Elements
  • False Positive and False Negative Results
  • Pop up and Alert Handling
  • Captcha or OTP Handling
  • Limited Reporting
  • Restricted to only Desktop Browsers Testing

 

Related: Web design interview questions & answers