Selenium Interview Questions & Answers

Question: What is Selenium?


Selenium is a suite of software tools to automate web browsers across many platforms (Different Operation Systems like MS Windows, Linux Macintosh etc.). It was launched in 2004, and it is open source Test Tool suite.

Question: What is Selenium WebDriver?


Selenium WebDriver is a tool for writing automated tests of websites. It is an API name and aims to mimic the behavior of a real user, and as such interacts with the HTML of the application. Selenium WebDriver is the successor of Selenium Remote Control which has been officially deprecated.

Question: Explain Selenium Web Driver Architecture?


Selenium Web Driver Architecture contains following components as mentioned below:

Question: What is cost of WebDriver, is this commercial or open source?


Selenium is an open source and free of cost.

Question: How you specify browser configurations with Selenium 3.0?


Following driver classes are used for browser configuration










Question: Which web driver implementation is fastest?


HTMLUnitDriver. Simple reason is HTMLUnitDriver does not execute tests on browser but plain http request – response which is far quick than launching a browser and executing tests. But then you may like to execute tests on a real browser than something running behind the scenes

Question: What all different element locators are available with Selenium?


Selenium uses following method to access elements:

Question: How to capture screen shot in Webdriver ?


Question: How do I clear content of a text box in Selenium 3.0 ?


WebElement element= driver.findElement("ElementID"));


Question: How to execute java scripts function ?


JavascriptExecutor js = (JavascriptExecutor) driver;

String title = (String) js.executeScript("pass your java scripts");

Question: How to count total number of rows of a table using Selenium 3.0 ?


List {WebElement} rows = driver.findElements(By.className("//table[@id='tableID']/tr"));

int totalRow = rows.size();

Question. How to delete Browser Cookies with Selenium Web Driver ?



Question: How to capture page title using Selenium ?


String title = driver.getTitle();

Question: How to store current url using Selenium?


String currentURL = driver.getCurrentUrl();

Question: How to store page source using Selenium?


String pagesource = driver.getPageSource();

Question: What is the difference between Assert and Verify in Selenium?


Assert: In simple words, if the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed.

Verify: In simple words, there won’t be any halt in the test execution even though the verify condition is true or false.

Question: What are Soft Assert and Hard Assert in Selenium?


Soft Assert: Soft Assert collects errors during @Test Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement.

Hard Assert: Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @Test

Internal Advertisement: NGA Overseas Hiring Model Live Now. Model helps connect QA Automation Engineers directly with Overseas Employers for high growth Software Testing Jobs both Remote and Onsite. To know more about the offered service, click here.

Question: What are the verification points available in Selenium?


In Selenium WebDriver, there is no built-in features for verification points. It totally depends on our coding style. some of the Verification points are

To check for page title

To check for certain text with in web page

To check for certain element (text box, button, drop down, etc.)

To check for click operation

To check for submit operation

To Check for navigation from 1 link to other link

Question: What are the different exceptions you have faced in Selenium WebDriver?


Some of the exceptions I have faced in my current project are:

a) ElementNotVisibleException

b) StaleElementReferenceException

Element Not visible Exception:

This exception will be thrown when you are trying to locate a particular element on webpage that is not currently visible eventhough it is present in the DOM. Also sometimes, if you are trying to locate an element with the xpath which associates with two or more element.

Stale Element Reference Exception:

A stale element reference exception is thrown in one of two cases, the first being more common than the second.

The two reasons for Stale element reference are

The element has been deleted entirely.

The element is no longer attached to the DOM.

We face this stale element reference exception when the element we are interacting is destroyed and then recreated again. When this happens the reference of the element in the DOM becomes stale. Hence we are not able to get the reference to the element.