Join us

Selenium Interview Question and Answers

Selenium Interview Question and Answers

1) What are the WebDriver supported Mobile Testing Drivers?

WebDriver supported "mobile testing drivers" are:

  • AndroidDriver
  • IphoneDriver
  • OperaMobileDriver

2) What are the popular programming languages supported by Selenium WebDriver to write Test Cases?

Selenium WebDriver supports the below languages to write Test Cases.

  • JAVA
  • PHP
  • Python
  • C#
  • Ruby
  • Perl

3) What's the difference between keyboard shortcuts and keyboard commands?

In most circumstances, TypeKeys() will produce a JavaScript event, whereas.type() would not.

4) What's the difference between the commands "type" and "typeAndWait"?

The "type" command is used to enter keyboard key values into a software web application's text box. It can also be used to choose values from a combo box, whereas the "typeAndWait" command is used when you finish typing and the software web page begins to reload. This command will wait for the page of the software programme to reload before proceeding. You must use a basic "type" command if there is no page reload event when typing.

5) How do you distinguish between findElement() and findElements()?

findElement(): Using the provided "locating technique," it is used to locate the first element on the current page. It gives you a single WebElement as a result.

findElements() searches the current page for all elements using the supplied "locating mechanism." It gives you a list of web elements as a result.

6) What are you waiting for? In selenium, how many different sorts of delays are there?

For AJAX-based applications, Selenium Webdriver introduces the concept of waits. There are two kinds of waiting times:

Waiting Time Implicit Waiting Time Explicit Waiting Time Implicit Waiting Time Exp

7) What is the most significant drawback of implicit waiting?

Implicit wait has the main disadvantage of slowing down test performance.

Another drawback of implicit waiting is that:

Assume you've established a waiting time limit of ten Seconds. Because you ordered it to wait a maximum of 10 seconds, and the elements show in the DOM in 11 seconds, your tests will fail.

8) What is Selenium Grid, and how does it work?

Selenium Grid enables you to deploy your tests across numerous machines at the same time. As a result, the same text script may be used to run tests on both a Windows and a Mac machine. It cuts down on test execution time and gives immediate feedback.

9) What are the advantages of automating the testing process?

  • The following are some of the advantages of automation testing.
  • It enables the execution of many test scenarios.
  • It allows for parallel processing.
  • Unattended execution is encouraged by automation testing.
  • It improves precision. As a result, it reduces human-caused errors.
  • It helps you save both time and money.

10) What is the best way to acquire the text of a web element?

The get command is used to retrieve the inner text of a web element. The get command takes no parameters and returns a string type value. It's also one of the most commonly used commands for checking messages, labels, and errors, among other things, from web pages. 

11) How to select value in a dropdown?

We use the WebDriver's Select class to select the value in the dropdown.



  1. Select selectByValue = new Select(driver.findElement("SelectID_One")));  
  2. selectByValue.selectByValue("greenvalue");  


  1. Select selectByVisibleText = new Select (driver.findElement("SelectID_Two")));  
  2. selectByVisibleText.selectByVisibleText("Lime");  
  3. Select selectByIndex = new Select(driver.findElement("SelectID_Three")));  
  4. selectByIndex.selectByIndex(2);  

12) What are the different types of navigation commands?

The navigation commands are as follows.


The above command needs no parameters and takes back the user to the previous webpage.



The above command allows the user to navigate to the next web page with reference to the browser's history.



The navigate().refresh() command allows the user to refresh the current web page by reloading all the web elements.



The navigate().to() command allows the user to launch a new web browser window and navigate to the specified URL.



13) How to deal with frame in WebDriver?

An inline frame abbreviates as an iframe. It is used to insert another document within the current document. These document can be HTML document or simply web page and nested web page.

Select iframe by id

driver.switchTo().frame("ID of the frame");
Locating iframe using tagName

Locating iframe using index


frame(Name of Frame)

driver.switchTo().frame("name of the frame");
frame(WebElement element)

Select Parent Window


14) Is there an HtmlUnitDriver for .NET?

To use HtmlUnit first use the RemoteWebDriver and pass it in the desired capabilities

IWebDriver driver= new RemoteWebDriver(DesiredCapabilities.HtmlUnit())

For the Firefox implementation to run, use

IWebDriver driver= new RemoteWebDriver(DesiredCapabilities.HtmlUnitWithJavaScript())

15) How can you redirect browsing from a browser through some proxy?

Selenium facilitates with a PROXY class to redirect browsing from a proxy. Look at the example below.


String PROXY = "";

org.openqa.selenium.Proxy proxy =;




DesiredCapabilities cap = new DesiredCapabilities();

cap.setCapability(CapabilityType.PROXY, proxy);

WebDriver driver = new FirefoxDriver(cap);

16) What is POM (Page Object Model) and how does it work? What are the benefits?

The Page Object Model is a design approach for storing web UI elements in an object directory. Each web page must have its own page class. The page class is in charge of locating WebElements in web pages and performing operations on them.

The following are some of the advantages of adopting POM.
It enhances code readability by separating actions and flows in the UI from Verification.
Because the Object Repository is independent of Test Cases, it can be used by several tests.
Coding reusability

17) How to capture screenshot in WebDriver?

Below is the program to capture screenshot in WebDriver.

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TakeScreenshot {
WebDriver drv;
public void setUp() throws Exception {
driver = new FirefoxDriver();
public void tearDown() throws Exception {

public void test() throws IOException {
//capture the screenshot
File scrFile = ((TakeScreenshot)drv).getScreenshotAs(OutputType.FILE);
// paste the screenshot in the desired location
FileUtils.copyFile(scrFile, new File("C:\\Screenshot\\Scr.jpg"))

18) How to type text in a textbox using Selenium?

The sendKeys("String to be entered") is used to enter the string in a textbox.


WebElement username = drv.findElement("Email"));
// entering username

19) How can you find if an element is displayed on the screen?

WebDriver allows user to check the visibility of the web elements. These web elements can be buttons, radio buttons, drop, checkboxes, boxes, labels etc. which are used with the following methods.

  • isDisplayed()
  • isSelected()
  • isEnabled()


boolean buttonPresence = driver.findElement("gbqfba")).isDisplayed();
boolean buttonSelected = driver.findElement("gbqfba")).isSelected();
boolean searchIconEnabled = driver.findElement("gbqfb")).isEnabled();

20) How to click on a hyper link using linkText?

The above command search the element using a link text, then click on that element and thus the user will be re-directed to the corresponding page.

The following command can access the link mentioned earlier.


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!


dridhOn Services


"World's #1 Online Certification IT Courses! dridhOn will provide you Best Software Training with Placement on all IT Courses."
User Popularity



Total Hits