Top 100 Selenium Interview Questions and Answers in 2021

In software engineering, testing is an important part of the development life cycle. The testing of applications can be done manually or through automation. Selenium was first introduced by Jason Huggins in 2004 for internal usage at the company ThoughtWorks. He was the first to use the Selenium RC (remote control). Selenium RC was an open-source software for that particular year. However, Selenium RC is now replaced by Selenium Web drivers. 

Selenium is a great place to start as it is an open-source tool and easy to use. The objective should be to cover all possible selenium interview questions and answers. Selenium is an automation tool used by testers across the globe to check for the readiness of the application.

The following are some selenium interview questions that one may face. Going through this list of top selenium interview questions and answers will help you.

Refer to our software testing interview questions which would help you to refresh your knowledge about general software testing questions.

Table of Contents

Some Basic Tips on Facing Selenium Interview Questions

  • Make your foundations strong.
  • Go through all the interview questions and answers covered here
  • Use Selenium practically 
  • Use sample codes to support your answers to Selenium interview questions.

Selenium Interview Questions and Answers 

1. What is Automation Testing?

The keyword here is “automation.” To enable something to run on its own, with minimal intervention is called automation. Any tool that helps in the validation of a test case is considered to be an automation tool. Selenium is an example of an open-source automation tool for testing web-based applications. 

2. What are the benefits of Automation Testing?

  1. Saves time and resources
  2. The process is now smoother
  3. Data management is simpler
  4. It can store all the test cases in one place
  5. Defect management is now easier

3. What are the advantages of Test Automation Framework

Test Automation Framework is nothing but a space where testers can build their test cases and execute them. Selenium is one such example of a test automation framework used for web based applications. A behavior driven development framework can go a long way in the entire testing flow. Following are some advantages of test automation framework. 

  • Test efficiency increases
  • More test cases are covered
  • Time is reduced
  • Cost to company is less
  • There is no duplicates in a test case
  • It is a one-stop place for reference
  • An open source testing tool like Selenium is also free

4. What is Selenium? What does it comprise of?

This is one of the most basic interview questions that is asked in a selenium interview. A selenium web driver interview is incomplete without this question.

Definition of Selenium (or Selenium IDE): It is an automation testing tool that helps in testing web-based applications.  Following are some key elements of selenium. Selenium implements the behavior-driven development framework.

READ  Top 40 Help Desk Interview Questions & Answers
Selenium IDESelenium GridSelenium WebDriver/ Selenium RC
IDE is the integrated development Environment, it is where the user interacts with the tool. It is a data driven testing framework. Object repository is created to aid the data.

Selenium IDE or Selenium Integrated Development Environment is available as a plugin for various web browsers to help test web based applications. 
A selenium grid helps in division of test cases which run parallel. This helps in reduction of testing time. Selenium RC is now rarely used. The webdriver has now replaced Selenium RC projects. There is a group of APIs that are used for testing, these are part of the Webdriver. This will enable the creation of scripts using any one of the programming languages available today.

5. When do you use Selenium Grid?

When you prepare for selenium interview questions, make sure you quote an example from your previous projects. 

Selenium uses a behavior driven development framework. As mentioned selenium grid allows one to operate various tests parallely in different machines. However, it is used in specific cases. 

  • Run test cases across different machines
  • In case there is a need to save time

6. What is a hub in a Selenium grid?

Basic Selenium Grid Structure

Hub is the centermost point in the selenium IDE grid. There is a server-client communication active during the test. This is how a simple selenium grid functions.  

7. What is a node in Selenium Grid?

Any connected machine to the hub of the grid is called a node. Typically every browser in use will be noted as one node. 

8. What are the types of WebDriver APIs available in Selenium?

Five types of WebDriver APIs available in the Selenium IDE.

  • Domain
  • Synchronisation
  • Navigation
  • Interrogation
  • Manipulation

9. Which WebDriver implementation claims to be the fastest?

HTMLUnit driver works with http requests that makes it faster in comparison to others that exist in the current repository of the web driver. 

10. What are the programming languages supported by Selenium WebDriver?

Selenium WebDriver

The all-new Selenium 2.0 can support a wide range of programming languages like – Ruby, Python, C#, and Java.

11. Which language is not supported by Selenium?

Languages like Perl and PHP have been discontinued in Selenium 2.0. 

12. What are the Operating Systems supported by Selenium WebDriver?

The following operating systems are compatible with the Webdriver in the Selenium IDE. These were also supported by Selenium RC. 

  • Mac OS
  • Windows
  • Solaris
  • Linux 

13. What are the testing types that can be supported by Selenium?

Following are the types of testing that can be covered using Selenium

  • Acceptance testing 
  • Functional testing  
  • Performance testing
  • Regression testing

Selenium Interview Questions and Answers

14. How many parameters can Selenium commands have at minimum?

Selenium IDE allows upto two parameters at once. The target and value are not always used in all cases. It has to be implemented on a need-only basis. 

15. What are the open-source frameworks supported by Selenium WebDriver?

Here is a list of the top 5 open-source frameworks that you can mention in your selenium interview. 

  1. Robot framework
  2. Galen
  3. Katalan
  4. Carina
  5. Appium

 16. What are the Locators available in Selenium?

While using the selenium IDE, there are some basic locators that you need to be familiar with. This question comes up on a regular basis in interview questions.

  • HTML: find_element_by_tag_name
  • CSS ID: find_element_by_id
  • CSS class name: find_element_by_class_name
  • Name attribute: find_element_by_name
  • DOM structure: find_element_by_xpath

17. When you use these locators ID, Name, XPath, Or CSS Selector?

It is important to learn all the important locators on the selenium IDE, Depending on the test case and its purpose you can use the given locator. ID is used to find the input web elements of the webpage. Name is another field in a web page where the user enters the name. Using any of the other elements in CSS selector can also be implemented. 

18.  Explain difference between Absolute Path and Relative Path?

Absolute pathRelative path
It gives the user the entire path from the first to the last elementThere is referencing used with the help of the first element to navigate to the desired element

19. What is the difference between Assert and Verify in Selenium?

Assert and verify commands that have varying but similar functionalities. Note the differences mentioned in the table below. 

Assert Verify
Check for true-false conditions. It works in a flow chart manner. Where true leads to certain steps and false leads to termination.
There are two asserts – hard and soft 
Check for true-false conditions. It works in a flow chart manner. Where true leads to certain steps and false leads to another set of steps. 
Only one kind of verify exists

20. What is Soft Assert and Hard Assert in Selenium?

Soft AssertHard Assert
Failure leads to immediate indication to the user. Then moves to the next test case in the test suite
An exception is thrown and handles by a PASS
Does not indicate any failures. Quickly moves to the next test case in the test suite
It shows errors after every execution. 

21.  What is the difference between setSpeed () and sleep () methods?

This method will execute for the given number of seconds/milliseconds. The delay is executed after the operation. For e.g. selenium.setSpeed(5000) This method is triggered only once it is called. For e.g thread.sleep() 

22. What are the verification points available in Selenium?

Selenese verify and assert commands can be used as verification points in the Selenium IDE. Here are some places where one might use verification points

  • Check for the right page title
  • Verify the input text 
  • See if the boxes are working on web page

23. What is the difference between “/” and “//” ?

While writing the test script for selenium testing, there are some notations that are used to communicate with the machines in the x-path.

Single Slash “/”Double Slash “//”
Single Slash is used to creating the absolute path. This is used to create XPath at the start of the nodeDouble slash is used to create a relative path. This would create the XPath at any point in the node.

24. How to launch a browser using Selenium WebDriver?

Following the steps given below to understand how to use the WebDriver.

Step 1: Select src folder and create a new class

Step 2: Open the following URL

Step 3: Download the Selenium WebDriver according to whichever web browser you use

Step 4: Extract the zip folder downloaded in the previous step

Step 5: Execute the following code  

WebDriver driver=new ChromeDriver();  // you can also use Webdriver driver = new FirefoxDriver()

Step 6: Now you can type the suitable code for the browser in the IDE and then you are good to go.

25. Can you navigate back and forth the web page in Selenium?

This is possible due to the Selenium WebDriver that gives basic navigation commands. The user can type in the Selenium WebDriver to navigate from one page to another.

Selenium Interview Questions and Answers

26. How to send ALT/SHIFT/CONTROL key in Selenium WebDriver? 

While using these three keys in Selenium WebDriver, we need to send the commands through methods. Typically one would use – keyDown (modifier key) and keyUP(modifier key). Here the modifier keys portion is to be replaced with either ALT, SHIFT or CONTROL. 

For e.g., keyDown(keys.ALT) or keyUP(Keys.SHIFT)

27. How to take screenshots in WebDriver?

 A key component in automation testing tools is the ability to provide enough information to testers for debugging. Therefore, capturing a screenshot is an effective method. 

Following sample code will help one capture the screenshots in the Selenium Webdriver

public static void main takeSnapshot( WebDriver webdriverString fileWithPath) //commands webdriver to take a snapshot
public void main ()
TakesScreenshot scrShot = ((TakesScreenshot)webdriver); 
File SrcFile=srcShot.getScreenshotAs(OutputType.FILE); 

28. How to set the size of the browser window using Selenium?

In order to set size there are two different methods. 

  1. getSize()
  2. Javascript executor

29. What are the different types of navigation commands in Selenium?

The following commands will help you in navigation within the web page.

  1. navigate.back()
  2. navigate.forwards()
  3. navigate.refresh()

30. What is the difference between driver.close() and driver.quit() methods?

Closes just the browser in useCloses all the browsers

31. How can you find Broken Links in a page using Selenium WebDriver?

Here are the steps that you can execute using Selenium WebDriver to identify broken links.

  • Use the <a> tag and gather the links
  • Execute a http request and store the response
  • The http response will show an error code which help you determine if the link is broken 

A code written with above logic will help in identification of broken links.

32. Is it possible to automate the captcha using Selenium?

No we can not automate the captcha using Selenium alone. 

33. List some scenarios which we cannot automate using Selenium WebDriver?

Below are some situations where it fails. 

  1. Auto Captcha 
  2. Entering of OTP 
  3. Bitmap comparison
  4. Can not read barcode or QR code

34. What are the challenges and limitations of Selenium WebDriver? 

In your selenium interview, this could be an important question. Here are the challenges and limitations. 

  1. It is difficult handle windows based services and mobile based applications
  2. Reporting and analysis is less
  3. Does not handle dynamic elements
  4. Can not give the page rendering time
  5. Does not work with browser based pop-ups
  6. Can not read captchas, barcodes or OTPs
READ  Top 100 Spring Interview Questions and Answers in 2021

35.  What are the types of waits available in Webdriver?

  • Implicit waits
  • Explicit waits
  • Fluent waits

36.  What is the difference between Page Object Model (POM) and Page Factory?

POM or page object model is used for a web UI element in this data-driven testing framework. It helps in creating an object repository. It helps in getting rid of repeated codes and helps in keeping the code tidy.

37. How to handle Ajax calls in Selenium WebDriver?

Here some tips to handling Ajax calls in Selenium Webdriver

  1. Add implicit waits 
  2. Add explicit waits 
  3. Add fluent waits 
  4. Add Webdriver waits 
  5. Use thread.sleep

38. What is JavaScriptExecutor and in which cases JavaScriptExecutor will help in Selenium automation?

JavaScriptExecutor – In order to execute JavaScript, Webdrivers have an interface that facilitates this function. 

Javascript Executor
Using JavaScript in Selenium

Locators are active and can be used for complex navigation as well. However, in case someone is unable to use them, JavaScriptExecutor is a great option. People with an understanding of JavaScript can easily use it to write simple code snippets. There are some methods available for users

  1. executeAsyncScript
  2. executeScript

39. How do you build an Object Repository in your project?

As the name suggests an object repository in simple terms is a place where objects are stored. Locators are primary objects. There are no in-built repositories available for the user. The user has to build it by themselves. There are two many types that can be created on the WebDriver – using properties file and using xml file.

Here are steps that will help you build the object repository. 

Step 1: Use eclipse to launch a java project. Create a new project

Step 2: Add the default settings for a new project

Step 3: Name the repository under ObjectRepositoryDemo (project name)  – ‘’

Step 4: Start storing the test data onto this properties file

40. Can You Use Selenium For Rest API Testing Or Web Services Testing?

So often in a selenium interview, this question is asked repeatedly to trick the candidate. It is a simple logical question that has a straight-forward answer i.e., No!

This automation testing tool only works on web-based applications. For API testing or Web services testing, other tools like Postman or SOAPUI are used.

Selenium Interview Questions and Answers

41. How do you read test data from Excel sheets?

In order to read test data from Excel, it needs to be used with Apache POI (Poor obfuscation implementation).

42. How do you find more than one Web Element in a list?

Use the findElement() method in the Webdriver. This will help with identifying more than one element on the web page.

43. How to handle hidden elements in Selenium WebDriver?

It will automatically throw an exception (“ElementNotVisibleException”). There is a need for a Javascript Executor which needs an additional script to be executed. This will automatically handle all exceptions and identify hidden elements.

44. How can we handle windows based pop ups in Selenium?

driver.getWindowHandles() will do the job of taking care of windows based pop ups at the instant of execution of test scripts. It can also help with switching between the windows. 

45. How to mouse hover on a web element using WebDriver?

The basic syntax of writing a mouse hover functionality is:


46. How to select the drop down elements in Selenium WebDriver?

There are methods that can help in picking a value in the static dropdown. All these methods behave like get() functions. Use these under void main string args function. 

  1. selectByVisibleText(String args) 
  2. selectByIndex(String args)
  3. selectByValue(String args)

47. Why should you use Selenium for Automation Testing?

When this question is asked in your selenium interview, consider listing the benefits. Here are some pointers that you can share with the interviewer.

  1. It is free software.
  2. The diversified programming language support. 
  3. Works with different operating systems.
  4. Enables plugins in all the browsers (internet explorer, chrome)
  5. Testing can be done using different types of hubs or machines.
  6. Accessible documentation. 
  7. East to write a test script.

48. Explain Difference Between MaxSessions Vs. MaxInstances Properties in Selenium Grid?

Indicates the number of browsers (Internet Explorer, Chrome).Indicates the number of browser instances present at that instant.

49. How to delete cookies in Selenium?

You can use a function like – driver.manage().deleteAllCookies().

50. How to fetch current pages’ URL in Selenium?

Use the method getCurrentURL() to help you with the latest surfed URL.

51. What happens if I run this command – Driver.get (“”) ;? 

Here http protocols have to be used. Therefore, this command will not be executed or will show an error message. Make sure you always include http or https in your test script before test execution.

52. Is Selenium Server needed to run WebDriver Scripts?

The whole point of having the WebDriver is to run the scripts to connect to the browser, therefore there is no need for an explicit Selenium Server to run the test script. Selenium server is rarely used. 

53. How to pause a test execution for 5 seconds at a specific point?

Here either implicit wait or explicit wait will work. thread.sleep(5000) – note it is 5000 ms. As all time is noted in milliseconds. 

54. How to press ENTER key on textbox In Selenium WebDriver?

Whenever keys are to be pressed, a code has to be written in any known programming language. Use it under the public void main function. These are used in a module based testing framework. Following test scripts can be used.


Other keys:-





55. How to submit a form using the Selenium WebDriver?

Following are the methods that need to be used for form submission in the test script. Implemented in the library architecture testing framework. 

  • use.submit()

56. How to get an attribute value using Selenium WebDriver?

The attributes here refers to the HTML elements that are captured while creating scripts keyword driven testing in Selenium. In order to address attributes in Selenium there is a method called getAttribute() that recognizes attributes and fetches them for you. 

57. How to get text elements in a web page using Selenium?

Selenium has sufficient methods for each functionality. The getText() will help in fetching required text for a given element. The elements of HTML can be easily retrieved and used by the Selenium tool. 

58. How to clear the text in the text box using Selenium WebDriver?

In case during your scripting you didn’t clear the text in the text box. There is a clear() method that can be used to clear all the text using the Web Driver. It is also a predefined function in the Webdriver. 

59. How to Login into any site if it is showing an Authentication Pop-Up for Username and Password?

While Selenium is poor at handling such situations, there are some easy work-arounds that one can use while creating the test scripts. 

  1. Pass the credential in the URL 
  2. Use a javascript or AutoIT script
  3. Use the alerts feature in the Web Driver

60. What happens if you mix both Thread.Sleep and WebDriver Waits in a Script?

Implicit wait and the explicit wait can be evoked for an application under test. A wait function – explicit wait or implicit wait allows the scripts to complete execution. When the waits like Thread. Sleep and Web Driver Waits get confused, the test execution time increases, and slow down the entire system while running the test scripts.

61. What is Fluent Wait In Selenium WebDriver?

When a large amount of time has to be used to wait for a particular condition to show up, the fluent wait is used in such cases in the test scripts. It usually occurs before an exception like “ElementNotVisibleException” is thrown.

62. How can you prepare a customised HTML report in TestNG using Hybrid testing framework?

The results get stored in a file named index.html. This file is routed to HTML files that contain the blueprint of the application under test. You can use the listeners and reporters in test scripts keyword driven situations.

  1. Listeners: org.testng.ITestListener (interface name)
  2. Reporters: org.testng.IReporter

63. What is meant by Selenese? Explain types of Selenium commands

Selenese is a term used for calling the selenium commands. In selenium interviews, mention some of the selenium commands.

  1. Actions
open(url)The URL request is triggered and allows entry into the web page
type(locator,value)A field input is taken through this command
Click (locator)A mouse hover click on a radio button or  checkbox 
  1. Accessors
storeTitle(variableName)Fetches the title of the page
storeText(locator, variableName)Fetches the text of an element
storeValue(locator, variableName)Fetches value of a field
  1. Assertions

This is where assert and verify commands are used. 

verifySelected(selectLocator, optionLocator)Verifies selected drop-down option
verifyAlert(pattern)Checks alert texts
verifyAllButtons(pattern)Check buttons selected

64. How can you achieve Database Testing using Selenium?

It is noted that Selenium testing is compatible with web applications only. Database testing is not directly achievable by Selenium. We can use third-party tools like JDBS (Java Database Connectivity). It is an SQL-based API that enables capturing of SQL queries. It is a simple three-step process that one can use to check the readiness of database queries.

Database testing using Selenium

65. What are the features of TesTNG?

TestTNG has interesting features that makes it suitable for using it as another automation tool.

  1. Can comprehend annotations
  2. Java is the basic programming language used
  3. Can work with integrated classes during test executions
  4. Test segrations can be done
  5. It is an easy plug-in
  6. Multi thread testing is possible
READ  Top 100 Angular Interview Questions and Answers in 2021


StaleElementReferenceException occurs on reuse of the same web based element. Here are the ways in which one can handle them.

  1. Page Factory Model: It does something called the lazy initialisation of web elements. Lazy initialisation refers to slowing down of the initialisation time.
  2. Relocating web element: Take care of this while writing your scripts in the first place.

67. What are different exceptions seen in Selenium Webdriver?

  • ElementNotVisibleException
  • ElementNotSelectableException
  • NoSuchElementException
  • NoSuchFrameException
  • StaleElementReferenceException
  • SessionNotFoundException
  • TimeoutException
  • WebDriverException

68. What are different types of TestNG Listeners in Selenium?

  1. MethodInterceptor
  2. AnnotationTransformer 
  3. ExecutionListener
  4. Hookable
  5. InvokedMethodListener
  6. Reporter
  7. Configurable 
  8. TestListener

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

The simple way to enable this by making the parameters as false. Here is a command or code that you can implement. 


SkipException() is also used in some cases.

70. What are Data Providers in TesTNG?

The data providers take care of the test data requirements in TestNG. It helps us invoking methods and scenarios by passing the required arguments for a dummy process during the test execution. Inheritance can also be used for data providers in TesTNG.

71. What is parameterization in TesTNG? How to pass parameters using TesTNG?

Parameterization is nothing but allocating a variable to take in a value as in when required for application under test. This enables re-creation of the actual flow in the web page.

Parameters can pass the captured value while reiterating the test cases. In an XML the desired parameters can be replaced or passed using simple annotation – @parametername (“username”, “password”). This allows the values to be passed dynamically. 

72. What is the significance of testng.xml?

Here are some key uses of a TestNG.xml file:-

  • Test cases are executed collectively
  • Flexibility with test methods
  • Multiple cases can be triggered from a single point
  • Has a list of folder, classes and methods in a single place
  • Parallel executions are now possible
  • Documentation all the testing scenarios helps in regression testing

73. Mention some of the popular tools used for automation testing

  1. Ranorex
  2. TestProject
  3. Kobiton
  4. Eggplant

74. Why do testers choose Selenium over QTP?

According to the table, Selenium has features that are more versatile.

SoftwareConsists of APIsDesktop based application
FlexibilityAll browsers (internet explorer, chrome), OSs, Languageshandle Windows based OS
License FreePaid
EnvironmentIntegration with third party tools and applicationsOnly the Oracle plugin is enabled. 

75. What is Continuous Integration? 

Continuous Integration is a development practice used by software engineers. The objective is to compile the code and share it in the repository as many times as possible. Which will enable the testers to execute the latest code after every change that is implemented. This helps testers to identify the defects. The defects are also taken up by the developers immediately from the pipeline.

76. Name some CI tools available in the market

Here are some CI tools that are currently being used in the market. 

Tool NameFeatures
JenkinsThe interface is user-friendly
It is easy to integrate various testing and production environments
Good for monitoring performance of the application in real-time as well
BambooCan give up to 100 remote machines
Execution of the test script in batches
Environment controls and permissions are easily maintained
CircleCIEasy integration with GitHub
Updates and alerts enabled in the tool
Customization available for testing purposes

77. What are the different types of annotations used in Selenium? Explain the JUnit annotation linked with Selenium.

Here are a few annotations used in Selenium (ranked in the order of importance)

  • @BeforeSuite
  • @BeforeTest
  • @AfterMethod
  • @AfterClass
  • @AfterTest
  • @AfterSuite

A unit test is the first basic test conducted after finishing the development of a certain code. A lot of developers use JUnit to run their first unit test. It is open-source software. It helps in automating the test scenarios. The idea is to automate the repetitive testing of the code.

This can be integrated with Selenium while testing web applications. JUnit annotations help with the functions in Selenium. Adding JUnit annotations helps understand the methods better. Here are some examples of JUnit annotations.

  • @ParameterizedTest 
  •  @RunWith 
  •  @RepeatedTest 
  •  @Parameters

78. Explain same origin policy and how Selenium handles it?

Same origin policy does not allow the DOM of a particular document to be accessed from an origin that is different from the specified origin policy. With the help of JavaScript, it overrides this issue. It deploys its own javascript response for authorisation and continuation. 

79. How can we create a data driven testing framework using TestNG?

There is often a requirement of an object repository in testing frameworks while using TestNG.Here is a sample code snippet used to write a data-driven framework in TestNG

public void main ()
 public Object[ ][ ] getData()
{Object [][] data = new Object [2][2];
data [0][0] = "Id1";data [0][1] = "Pass1";data[1][0] = "Id2";data[1][1] = "Pass2";
return data;}

80. How can you use the Recovery Scenario in WebDriver?

There are two types of recoveries – pre recovery and post recovery.

  • Pre-recovery: Become aware of situations that may occur and look for ways to recover from it
  • Post-recovery: Once execution is completed and pre recovery settings are covered, then the post recovery comes in place. It is to achieve the last normal state of the execution that needs to be met. 

The following diagram depicts the kind of triggers that can lead to the pre-and post-recovery states.

Selenium Interview Questions and Answers

81. What are the methods available to Upload a file in Selenium?

Following are methods of uploading a file. 

  1. Simple use of sendKeys() 
  2. Write a code that would pick up the web elements in the HTML and upload the necessary file.
  3. Use an third party tools like TestNG, Jenkins to do the uploading of file
  4. Can also take help of robot class

82. What are the methods available to Download a file in Selenium?

These are the following methods through which one can download files in Selenium

  1. AutoIT – which is an automation tool
  2. Robot Class
  3. Browser Profile settings. 

83. How to run Selenium Web Driver Test from the command line?

Here are the steps that you need to follow in order to run your tests from the command line

  1. Download java from the java website
  2. Install Java using the exe download file
  3. Unravel the Selenium Remote Control (RC) Pack
  4. Open the command prompt window. 
  5. Run the command 
java -jar selenium-server.jar -htmlSuite “*chrome” “” “C:\my_testsuite\myfirst_project.html”

Here the browser can be firefox or chrome or internet explorer (depending on what you put in the command).

84. How to switch between frames in Selenium?

There are three different ways of switching between frames in Selenium

  1. By Web Element
  2. By Index
  3. By Name/ID
  • Using Name/ID
    • driver.switchTo().frame(“iframe1”);
    • driver.switchTo().frame(“id of the element”);
  • Using Index
    • driver.switchTo().frame(0);
    • driver.switchTo().frame(1);

85. How to resize Browser Window Using Selenium WebDriver?

Easy code snippets are available on the internet to be run on the selenium WebDriver. After fetching the web address you can run the following command. The code will be put under the public void main function.

Static void main string ()
ChromeOptions options = new ChromeOptions();
options.addArguments(“windows-size=800,400”); //test method for resize

86. What are cross browser testing tools to run selenium scripts on cloud?

Cross browsing testing is to check if the website is functional and loads in a certain amount of time.  Here is what you need to do cross browsing testing in Selenium.

  1. Create a BrowserStack Account
  2. Note down the Username and account key for the BrowserStack
  3. Install Selenium Jars
  4. Install TestNG Jars

Then you are ready to run the cross browsing testing through BrowserStack in Selenium 

87. What are the desired capabilities in Selenium?

Each browser has a certain list of properties that helps in execution of a cross browser test for various web applications. Desired capabilities are a class in Selenium testing tool to help with these lists of properties of a browser. They withhold their keys and their values to note the name, version and path of the browser during the run time of the test scripts. 

88. Why do we need desired capabilities in Selenium?

There is a need to run the tests in a given environment. The desired capabilities help channel the communication on the settings of the web browser with the webdriver. Therefore, they place a crucial role in functional automation testing.

89. What are the different desired capabilities’ methods in Selenium?

Use the following test method

  1. getBrowserName()
  2. setBrowserName()
  3. getVersion()
  4. setVersion()
  5. getPlatform()
  6. setPlatform()
  7. getCapabilityMethod()
  8. setCapabilityMethod()

90. Where have you applied OOPs in Automation Framework?

  1. Abstraction

The Page Object Model design uses abstraction in its working. The locators are used in this case for testing. The method of hiding the implementation is evoked through this system in the Automation Framework.

  1. Interface

The interface provided in the Automation Framework is the browser. Chrome, firefox are readily used browsers that act as an interface. A classic example of this usage is:-

Webdriver driver = new FirefoxDriver(); //test method interface
WebDriver driver=new ChromeDriver(); 
  1. Inheritance

Base Class is created for initialisation of web drivers’ interface, waits and excels files with the test data. There is inheritance set within the class for all these initialized web elements. 

  1. Polymorphism

There is constant overloading and overriding mechanism implemented in the automation framework. One can directly declare methods in the child class. This is a classic example of overriding. 

91. Explain the Selenium framework in brief

Selenium Framework

There are various kinds of frameworks:-

  1. Data driven framework – To create separate data and test cases. This makes it easy to deal with data separately. Also one can create an object repository.
  2. Keyword driven testing framework – It is done by separation of keywords and functions. This will speed up the entire process.
  3. Hybrid testing framework – A combination of  data driven framework and keyword driven testing framework is called a hybrid structure. That uses both the capabilities. 

92. What are the differences between Selenium 2.0 and Selenium 3.0?

Selenium 2.0Selenium 3.0
Compatible browsers: Mozilla, Chrome and Internet Explorer Along with the Selenium 2.0 browsers, it now supports – Edge, Safari
AndroidDriver for mobile devicesAppium for mobile devices
WebDriver+SeleniumRCSelenium RC or selenium remote control is just supported by a the WebDriver

93. What is a Robot class?

In order to implement the automation code in testing Robot Class is used in Selenium. It can trigger inputs for the automation system. The integration of robot class helps in running codes with ease. It helps in dealing with challenges related to window pop ups as well. 

94. Explain the difference between findElement() and findElements() in Selenium.

The first element discovered is returned by the function.The list of elements discovered are returned by the function
Can throw “NoSuchElementException”There are no exceptions
Identifies unique elementsIdentifies a group of elements

95. What type of test cases to be automated?

There are different types of test scenarios that a tester comes across. It is necessary to identify which cases need to be automated. Following things are considered before creating an automation script. 

  1. Check how many times the test case is used and how often is it tested
  2. Learn the data behaviour and flow to identify the pain points which can be reduced by automation. 
  3. Pick the cases that have a predictable outcome
  4. Are there multiple iterations of the same use case? If yes, then automation is a formidable option.
  5. Avoid the test case which is dynamic in nature. 

96. How can we maximize browser windows in Selenium?

A simple code can be written either through Javascript or directly on Selenium.

driver.manage().window().maximize(); //test method

97. What is the difference between driver.getWindowHandle() and driver.getWindowHandles() in the WebDriver?

Gives the handle of the page that the user is onGives the handles of all the pages that are available. 

98. How to find whether an element is displayed on the webpage?

Following functions can be used to identify the presence of an element:

  1. isEnabled()
  2. isSelected()
  3. isDisplayed()

99. What are the types of data that Selenium can handle?

  1. YAML
  2. XML
  3. CSV
  4. EXCEL
  5. JSON
  6. SQL

100. Explain the line of code Webdriver driver = new FirefoxDriver();

This particular code deals with the Interface concept in OOPs. This helps in the initialization of an object with type as Webdriver for an object FirefoxDriver. 


Answering all the Selenium Webdriver interview questions is definitely not easy to crack. With basic understanding and practical knowledge, you are assured of landing your dream job as a Quality Assurance Engineer. This blog lists the frequently asked selenium interview questions for aspiring testers.