50 Selenium Interview Questions and Answers 2017 + PDF Download

If you are a software tester looking for the job of test automation or testing, you are at the right place. We have listed over 50+ Selenium interview questions to crack a job interview. In this post, you will get a short and simple answer to all the Selenium Webdriver interview questions for all the experienced and non-experienced candidates.

Selenium Interview Questions and Answers

For those who don’t know about Selenium, it is actually a flexible software testing framework used for web applications. It features a playback/record tool to conduct tests without having to learn Selenium IDE, a test scripting language. It also features Selenese (domain-based language) to write tests in several programming languages, such as Java, C#, Groovy, PHP, Perl, Ruby, Python, and Scala.

Recommended reading: Subject line suggestions for professional mails

selenium interview questions and answers

Selenium Interview Questions Based on Experience

Along with face-to-face interviews, this questionnaire will also benefit you in telephonic sessions. Most of the IT companies nowadays prefer to assess the technical skills of a candidate over phone before inviting them for walk-in interviews. An interviewer won’t ask only theoretical or conceptual questions. They would also test a little differ by asking tricky questions regarding the technology they use. This is where these Selenium Webdriver interview questions come to the rescue.

Selenium Interview Questions for Freshers

  1. What is Selenium?

Selenium is a software program which automates web applications and browsers, not desktop applications. It supports various OS platforms, including Linux, Mac, and Windows. Its tools are used basically for Regression and Functional Testing.

  1. What are the Components of Selenium?
  • Selenium Integrated Development Environment (IDE)
  • Selenium Remote Control (RC)
  • Selenium WebDriver
  • Selenium Grid
  1. What is Selenium IDE?

Selenium IDE comes as a Firefox plugin. It is an integrated development platform to develop and deploy Selenium Test series. It is used to record, playback, edit, and debug the test cases.

  1. What is Selenium RC?

Selenium RC (Remote Control) is a testing tool to write automated UI tests of web applications in any language for any HTTP website through the JavaScript-based browser.

  1. What is Selenium WebDriver?

Selenium WebDriver creates Test cases to run on several browsers, through WebDriver API commands and element locators. With WebDriver, we can use Testing Framework Annotations and Programming features to enhance Test cases.

It is built to provide more concise, easier programming UI along with facing some issues in Selenium-RC API. This tool is developed to support dynamic pages where elements may change without even reloading the page.

  1. What is Selenium Grid?

With Selenium Grid, we can run Tests on various environments against several browsers. In other words, it supports distributed execution of Tests. We can run multiple tests against various machines at the same time in different operating systems and browsers.

  1. What is Apache Maven? How is it used in Selenium?

Maven is a Java build management and project management component. With Maven, we can easily manage Java project builds. As a Java build management component, Maven enables us to manage the Selenium build with ease. It manages the documentation, build compilation, and other project related tasks of Selenium test project. With it, we can also create the accurate project structure, manage and add jar files in build path, etc.

  1. What is TestNG? What are its Usage in Selenium?

Like NUnit or JUnit in Group Test cases TestNG is also a Testing Framework used to run parameterized Tests, Test batches, and to provide in-depth HTML test reports.

  1. What are the Pros of Selenium?
  • Supports several programming languages to create Test scripts
  • Open Source program
  • Multi-browser support to conduct Test Scripts/Test Cases.
  • Supports several OS platforms to initiate Testing.
  • Enables Parallel Test execution.
  1. What are the Cons of Selenium?
  • No built-in support for Reporting Results
  • No Tech Support
  • Only for Browser/Web-based applications
  • No support for new features

Selenium WebDriver Interview Questions for 2 Years Experience

  1. What are the WebDriver API categories used in Selenium?
  • ChromeDriver,
  • AndroidDriver,
  • FirefoxDriver,
  • EventFiringWebDriver,
  • InternetExplorerDriver,
  • HTMLUnitDriver,
  • iPhoneDriver,
  • RemoteWebDriver,
  1. How to Ensure the Successful Loading of Webpage with Selenium and WebDriver?

Use the following codes to make sure that your webpage is loaded successfully in Selenium. Choose an element and stick to it till it becomes a link to click.

selenium.waitForPageToLoad(“5000”);

// Or

while (!(selenium.isElementPresent(“any page element “)==true)) {

selenium.setSpeed(“5”);

Thread.sleep(5);

}

Use the following code in WebDriver –

WebDriverWait check = new WebDriverWait(driver, 100);

check.until(ExpectedConditions.anyElement(By.id(id)));

  1. How to Execute a Batch File in Selenium WebDriver?

Use the following Java code to define your requirements before conducting the automation –

Process batch = Runtime.getRuntime.exec(“path of the batch file”);

batch.waitFor();

  1. How to start Selenium IDE Test Suite?

Run the following command –

Java -jar “C:\Selenium Webdriver Questions\selenium-server-standalone-2.33.0.jar” -htmlSuite “*firefox” “http://www.google.com” ” “C:\Selenium Webdriver Questions\SeleniumSuite.HTML”

  1. How to Access JavaScript Variable in WebDriver?

Use the following JavaScript code to read any variable in Selenium WebDriver –

// Initialize the JS object.

JavascriptExecutor JS = (JavascriptExecutor) webdriver;

// Get the current site title.

String sitetitle = (String)JS.executeScript(“return document.title”);

System.out.println(“My Site Title: ” + sitetitle);

  1. What are the Common Exceptions in Webdriver?
  • NoAlertPresentException,
  • WebDriverException,
  • NoSuchElementException,
  • NoSuchWindowException,
  • TimeoutException
  1. What is FirefoxDriver? What Interface Does It Conduct?

It is a Java class. It conducts <WebDriver> interface and all of its methods.

  1. What is the Difference between quit() and close () methods?

quit() – It closes all the opened windows and browser too.

close() – It closes only those browser window that is currently open.

  1. How to increase Right Click operation in Selenium WebDriver?

By using the Action class features, for example –

Actions test = new Actions(driver); // Here, driver is the object of WebDriver class.

test.moveToElement(element).perform();

test.contextClick().perform();

  1. How to Check Radio Button/Checkbox Status?

By using the isSelected() method –

boolean test = driver.findElement(By.xpath(“checkbox/radio button XPath”)).isSelected();

Selenium WebDriver Interview Questions for 3 Years Experience

  1. How to Enter Text without sendKeys()?

Use both of the wrapper classes and JavaScript classes with WebDriver extension, such as –

lic static void setAttribute(WebElement element, String attributeName, String value)

{

WrapsDriver wrappedElement = (WrapsDriver) element;

JavascriptExecutor driver = (JavascriptExecutor)wrappedElement.getWrappedDriver();

driver.executeScript(“arguments[0].setAttribute(arguments[1],arguments[2])”, element, attributeName, value);

}

Call this method in test script and pass the text you like to enter and the text field attribute.

  1. Can we Handle https domain in Selenium?

Yes, by changing FirefoxProfile setting –

Syntax-public class HTTPSSecuredConnection {

public static void main(String[] args){

FirefoxProfile profile = new FirefoxProfile();

profile.setAcceptUntrustedCertificates(false);

WebDriver driver = new FirefoxDriver(profile);

driver.get(“url”);

}

}

  1. What Headless browser is called?

HTMLUnitDriver

  1. What are the Pros of TestNG?

With the help of TestNG, you can conduct test cases according to group.

  • Annotations are simple
  • Generates three types of reports
  • We can conduct execution of Selenium Test cases in parallel
  • Changing order of execution is possible
  • Execute failed test cases
  • Execute the test method without main function
  • Generate xml file to conduct the whole test suite. In this file, we can align the execution preferences and skip execution of a specific test case.
  1. What are Keyword Driven and Data driven Framework?

In Data driven Framework, Test Data is aligned and kept aside Test Scripts, when Test Case logic is held inside.

On the flip side, Table-Driven or Keyword-Driven Framework needs creation of keywords and data tables, along with using test automation tool to execute them.

  1. Why Use AutoIt Tool?

We often get stuck due to some barriers like window-based popup, while testing through Selenium. But Selenium supports only web-based tools and it cannot handle it. So, we have to use AutoIt tool with Selenium script. It can easily handle window-based apps as it is powered by VBScript.

  1. Why to Use contectClick()?

To right click

  1. What are the Components of Framework?
  • Drivers folder
  • Excel file
  • Jars folder
  • Library – ConfigLibrary, Assertion, ProjectSpecificLibrary, GenericLibrary, Modules
  1. Which Web Browser Does Selenium IDE Support?

Since is a Firefox add-on, it supports Firefox only.

  1. Which is Better – CSS or xpath?

Ans – xpath

Recommended reading: Best way to download IEEE papers

Selenium WebDriver Interview Questions for 4 Years Experience

  1. Why Should We Prefer Selenium over Others?
  • Free of cost,
  • Enables Powerful and Simple DOM-based testing,
  • Supports several languages, including C#, Ruby, Java, Python etc.
  1. Difference between Selenium WebDriver and Selenium RC

Selenium WebDriver – It uses built-in support of your browser to use it.

Selenium RC – It adds JavaScript function on the browsers while loading webpage.

  1. Why WebDriver is better than Selenium RC?
  • Great API
  • No need to run Selenium RC Server
  • Faster and native automation – Less prone to browser configuration and error
  • Fast Tests with Headless HTMLUnitDriver access
  1. How to Handle Dynamic Elements?

Ans – We can manage Dynamic Element by creating relative xpath.

  1. What are the Checkpoints or Assertions used in Script?
  • Validations against element,
  • Is page title the same as expected,
  • Is text given on the page
  1. What is Actions Class?

In WebDriver, Actions Class controls the mouse’s actions.

  1. Difference between @BeforeClass and @BeforeMethod

@BeforeClass is executed before each class.

@BeforeMethod is executed before each @Test method.

  1. What is Object Repository?

It is a very important part of any UI Automation process. A tester can store every object that can be helpful in scripts in several centralized areas instead of getting them sprinkled all around the Test scripts. It is not all about WET. We can use it in any UI automation.

  1. What about OOPS Concepts?
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
  1. What about Inheritance?

As the name suggests, it inherits any class feature with some connections between interface and class.

Selenium WebDriver Interview Questions for Highly Experienced

  1. What is IntelliJ?

It is an IDE to write faster and better Selenium code. We can use it as an alternative to Eclipse and Java bean.

  1. How to Customize TestNG Report?

There are two different ways to customize it –

  • Through IReporter Interface
  • Through ITestListener interface
  1. What is Listeners in WebDriver?

As the name suggests, Listeners “listen” to the selenium script event and work accordingly. With Listeners, we can customize TestNG logs or reports. TestNG Listeners and WebDriver Listeners are two main kind of listeners.

  1. What Java API is applied to Generate PDF Reports?

We need Java API IText to generate PDF logs

  1. What type of Listeners used in TestNG?
  • IAnnotationTransformer
  • IConfigurationListener
  • IConfigurable
  • IAnnotationTransformer2
  • IHookable
  • IExecutionListener
  • IMethodInterceptor
  • IReporter
  • ITestListener
  • ISuiteListener
  • IInvokedMethodListener
  • IInvokedMethodListener2
  1. What is desired capability? How to use it in Selenium?

It is a series of value or key pairs which consists of browser information, such as browser version, name of browser, path to the browser driver etc. to find out the behavior of browser.

In Selenium, it is helpful to configure the Selenium WebDriver instance and used when it comes to run test cases on any browser with various versions of operating systems.

  1. When to use AutoIT?

Selenium is used to automate web applications on various browsers. But AutoIT is used to handle non-HTML popup and window UI in the application.

  1. Which API to use in Database Testing?

In Selenium WebDriver, we have to use Java Database Connectivity (JDBC) API for Database testing to execute SQL commands.

  1. Why Use Session Handling with Selenium?

When it comes to work with Selenium, we should use Session Handling because the WedDriver need to work with the browser every time to execute the command in test execution. There are chances that someone else may start execution of any other script before the existing execution finishes in the same browser type and in the same machine, during execution. To avoid these instances, Session Handling is required.

  1. What are the Pros of Git Hub in Selenium?
  • It allows multiple people to update project info while working on the same project and tell other teammates at the same time.
  • You can generate the project from remote repository with Jenkins in regular basis. You can easily keep an eye on failed builds.

Recommended reading: Cabin crew interview questions

Here are some more tips for Selenium interview

Final Words

In this post, we have listed the most asked Selenium WebDriver Interview questions. But there is always a room for upgrades and improvements. We will stay up-to-date with recent changes in this technology and add more new questions ahead, to improve your confidence and skills needed to face interview.

We have covered huge range of Selenium quizzes and interview questions. These are the fresh set of interview questions. If you found the above questions useful, you may share your knowledge drive and this list of questions to your friends.