Since there is so much dependency on the web today, ensuring up-time and functioning of web apps is an evident need. Selenium is an automation testing tool developed precisely for that purpose, and this blog lists the frequently asked Selenium Interview Questions for those(freshers & experienced) planning to get into the testing domain.
1. What are the significant changes in upgrades in various Selenium versions?
Selenium v1 included only three suites of tools: Selenium IDE, Selenium RC and Selenium Grid. Note that there was no WebDriver in Selenium v1. Selenium WebDriver was introduced in Selenium v2. With the onset of WebDriver, Selenium RC got deprecated and is not in use since. Older versions of RC are available in the market though, but support for RC is not available. Currently, Selenium v3 is in use, and it comprises IDE, WebDriver and Grid. Selenium 4 is actually the latest version.
IDE is used for recording and playback of tests, WebDriver is used for testing dynamic web applications via a programming interface and Grid is used for deploying tests in remote host machines.
2. Explain the different exceptions in Selenium WebDriver.
3. What is an exception test in Selenium?
An exception test is an exception that you expect will be thrown inside a test class. If you have written a test case in such a way that it should throw an exception, then you can use the @Test annotation and specify which exception you will be expecting by mentioning it in the parameters. Take a look at the example below: @Test(expectedException = NoSuchElementException.class)
Do note the syntax, where the exception is suffixed with .class
4. Why and how will you use an Excel Sheet in your project?
5. What is Page Factory?
Page Factory gives an optimized way to implement Page Object Model. When we say it is optimized, it refers to the fact that the memory utilization is very good and also the implementation is done in an object oriented manner.
Page Factory is used to initialize the elements of the Page Object or instantiate the Page Objects itself. Annotations for elements can also be created (and recommended) as the describing properties may not always be descriptive enough to differentiate one object from the other.
6. What are the different types of WAIT statements in Selenium WebDriver? Or the question can be framed like this: How do you achieve synchronization in WebDriver?
There are basically two types of wait statements: Implicit Wait and Explicit Wait.
Implicit wait instructs the WebDriver to wait for some time by polling the DOM. Once you have declared implicit wait, it will be available for the entire life of the WebDriver instance. By default, the value will be 0. If you set a longer default, then the behavior will poll the DOM on a periodic basis depending on the browser/ driver implementation.
Explicit wait instructs the execution to wait for some time until some condition is achieved. Some of those conditions to be attained are:
7. What are different types of frameworks?
8. Which files can be used as data sources for different frameworks?
Some of the file types of the dataset can be: excel, xml, text, csv, etc.
9. What is Selenese?
10. Can Selenium handle window pop-ups?