Selenium Interview Questions and Answers

    0 Votes

Frequently asked Selenium interview questions and answers for freshers and 2-5 year experienced testers on Selenium Components, Advantages, IDE, Remote Control, supported languages, client drivers, AutoIT script  etc.

1. What is the Difference between Manual Testing and Automation Testing?
  • Tests conducted by testers manually is called Manual Testing, wherein they compare the expected and actual functionality are in accordance with the test cases.
  • Tests conducted by using software tool is called Automation Testing, wherein the expected results are fed into the tool to be compared with the actual output of software being tested.
  • Refer link for more Q&A on Automation Testing. (Link to Automation Testing QA)


2. What are the Popular tools used for automation testing?
  • Selenium
  • HP UFT(Formerly QTP) 
  • Rational Robot
  • IBM Rational Functional Tester
3. Explain the advantages of Automation Testing
  • Reduced test execution time
  • Can be executed in cross platforms test cases (different OS, browsers, environment, etc)
  • Simplifies complex functional tests
  • Automating repetitive tasks
  • Enables parallel execution


4. What is Selenium Testing?

Selenium is a web browser automation tool, supports numerous scripting language and technologies.

5. What are the major Selenium components?

  • Selenium IDE
  • Selenium RC
  • Selenium Webdriver
  • Selenium Grid

6. What are the testing types supported by Selenium?

Selenium supports Functional and Regression Testing

7. What is Selenium IDE

Selenium IDE is Integrated Development Environment, which is implemented as Firefox extension. It helps us record, edit and debug the tests.

8. Explain the advantages of Selenium IDE?

  • Easy to Record and Playback
  • Command auto-complete 
  • Can set breakpoints while debug mode
  • Assert, Verify and WaitFor options

9. Language used in Selenium IDE

Language used is Selenese

10. Does Selenium IDE support multiple test case execution?

Selenium IDE supports suite creation wherein the testcases created under a Suite is executed one by one. Test suite is a simple HTML file listing the tests to be executed in a user-defined format.

11. Can tests created in Selenium IDE run in different browser?

Selenium IDE created test cases can be executed as suite under Selenium RC using command line interface which invokes Selenium RC Server.
Ex, java -jar selenium-server.jar -htmlSuite "*firefox" "" "c:\absolute\path\to\my\HTMLSuite.html" "c:\absolute\path\to\my\results.html"

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

  • When an “assert” command fails, the test is aborted. 
  • Whereas, when a “verify” command fails, the test will continue execution of next command in test after logging the failure.

13. What is a Xpath?

Xpath is a XML path language, which describes a way to traverse through XML document to locate nodes. Same is used to locate elements in HTML.
14. What is the difference between '/' and '//' in Xpath?

'/' used to indicate absolute path of an element, majorly when the user knows exact path of an element. Whereas '//' used to indicate relative path of an element, majorly to locate an element from any part of the HTML file.

15. What is Selenium RC?

Selenium Remote Control (RC) is the first selenium project before Selenium Webdriver. It's a test tool that allows you to write automated web application user interface tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.

16. What are the Selenium RC supported languages/client drivers?

Supported languages/client drivers are :

  • Java
  • Ruby
  • Python
  • Perl
  • PHP
  • .Net

17. Explain the advantages of Selenium

  • Open Source
  • iUser communities for addressing the issues faced
  • Cross browser compatibility
  • Multiple platform compatibility
  • Supports multiple programming/scripting languages

18. What are the different type of locators used in Selenium

Locators are used to identify elements within a web page, types are listed below :

  • ID
  • Name
  • LinkText
  • PartialLinkText
  • ClassName
  • TagName
  • Xpath
  • CSS Selector
  • DOM

19. What is Selenium Grid?

Selenium Grid allows us to run tests on different machines against different browsers in parallel. Here different machines can be of different OS and supports distributed test execution.

20. What is the Difference between Selenium1 and Selenium2?

Selenium1 is Selenium RC and Selenium2 is Selenium Webdriver, major difference is that the Selenium RC communicates to browser via Server, whereas the Webdriver makes direct calls to browser native support for automation.

21. What are the Browser launch commands used in Webdriver

Following are some major browser related launch commands :

WebDriver driver = new FirefoxDriver(); //Mozilla
WebDriver driver = new ChromeDriver(); //Chrome
WebDriver driver = new InternetExplorerDriver(); //Internet Explorer
WebDriver driver = new RemoteWebDriver(); // Grid
WebDriver driver = new HtmlUnitDriver(); //Headless browser

22. List down the Webdriver supported drivers

SeleniumHQ drivers :

  • FirefoxDriver
  • InternetExplorerDriver 
  • SafariDriver 
  • HtmlUnitDriver

Third party drivers :

  • ChromeDriver 
  • OperaDriver 
  • AndroidDriver 
  • IPhoneDriver 
  • Etc

23. Explain in detail different 'Wait' operations in Selenium Webdriver

There are two wait types available in Selenium Webdriver - Implicit Wait and Explicit Wait
Implicit Wait
An implicit wait is to tell Webdriver to provide a default waiting time when trying to find an element or elements if they are not immediately available. The default wait time is 0. For Example,
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
WebElement myDynamicElement = driver.findElement("myDynamicElement"));
Explicit Wait
Used to halt the execution till the time a particular condition is met. Unlike Implicit waits, Explicit waits are applied for a particular instance only. For example,
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable("someid")));


24. What are the differences between findElement() and findElements() ?
  • findElement() : It finds the first element within the current page using the given locating mechanism. It returns a single WebElement.
  • findElements() : Using the given locating mechanism, find all the elements within the current page. It returns a list of web elements.


25. What is the Command to enter string into textbox using Selenium Webdriver



WebDriver driver = new FirefoxDriver();
WebElement searchName=driver.findElement("gs_htif0"));

26. How to switch between frames in Webdriver?

Select frame by Index :

driver.switchTo().frame(int arg0);

Select frame by Name or ID :

driver.switchTo().frame(String arg0);

Select frame by WebElement :

driver.switchTo().frame(WebElement frameElement);

27. How handle pop up in web application using Selenium Webdriver?

Alert alert = driver.switchTo().alert();

To cancel the message :


To accept the message :


To get string from alert message :

String msg = alert.getText();

To send string to alert box :


28. Can Selenium Webdriver handle windows pop up?

No, but a simple program called AutoIT can generate .exe file to be called in webdriver script.

29. Write AutoIT script to upload a file

Wait 10 seconds for the Upload window to appear


Set input focus to the edit control of Upload window using the handle returned by WinWait

ControlFocus("File Upload","","Edit1")

Set the File name text on the Edit field

ControlSetText("File Upload", "", "Edit1", "Complete file path")

Click on the Open button

ControlClick("File Upload", "","Button1");

30. How to call AutoIT script from Selenium Webdriver?

Runtime.getRuntime().exec("complete AutoIt .exe filepath");
31. Write down Selenium script to take screenshot
There are multiple ways to achieve the same, one of them is listed below :
WebDriver driver = new FirefoxDriver();
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));


32. Name the fastest web driver
WebDriver driver = new HtmlUnitDriver(); //Headless browser
33. What are the Different frameworks available for JAVA Webdriver
  • Junit
  • TestNG


34. Best Automation Framework type preferred for Webdriver

Hybrid Framework – Its combination of both Data and Keyword Driven Framework

35. List down the basic browser commands

Get Webpage :


Get Title :


Get Current URL :


Get page source :


Close current window :


Quit the browser :


36. What is TestNG?

TestNG is similar to Junit and an open source automated testing framework

37. What are the advantages of TestNG?

  • Ability to produce HTML reports
  • iAnnotations
  • Grouping and prioritizing made easy
  • Parallel execution of test
  • Parametrization

38. List annotations in TestNG

@BeforeSuite: The method will be run before all tests in this suite.
@AfterSuite: The method will be run after all tests in suite.
@BeforeTest: The method will be run before any test method belonging to the classes.
@AfterTest: The method will be run after all the test methods belonging to the classes.
@BeforeGroups: The list of groups that this configuration method will run before.
@AfterGroups: The list of groups that this configuration method will run after.
@BeforeClass: The method will be run before the first test method in the current class is invoked.
@AfterClass: The method will be run after all the test methods in the current class have been run.
@BeforeMethod: The method will be run before each test method.
@AfterMethod: The method will be run after each test method.
@Test: The method is a part of a test case.

39. Whar are the exceptions faced in Webdriver

Some of the exceptions faced are :

  • ElementNotVisibleException,
  • ElementNotSelectableException,
  • NoAlertPresentException,
  • NoSuchAttributeException,
  • NoSuchWindowException,
  • TimeoutException,
  • WebDriverException etc

40. Explain the ways to handle radio button

For radio button click :

WebElement radioButton = driver.findElement("radioID"));;

To check if the radio button is selected :

List radioButton = driver.findElements("radioName")); 
boolean rValue = radioButton.get(0).isSelected();

NOTE : rValue will be set to true if selected, else false.

41. Explain the ways to handle Dropdown list

Selection :


Deselect :


Popular Videos


How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

Software Testing Interview Questions and Answers
Automation Testing Interview Questions and Answers