Selenium Interview Questions and answer

Selenium Interview Questions and answer

Selenium Interview Questions and answer. Welcome readers, looking forward to crack a Selenium Interview? Don’t worry we’ve got you covered! So here is a collection of some of the most frequent Selenium Interview Question and answer. But first let us take a look at a brief introduction about Selenium.

Selenium Interview Questions and answer

So Selenium is an open-source tool that automates web browsers. It provides a single interface that lets you write test scripts in programming languages like Ruby, Java, NodeJS, PHP, Perl, Python, and C#, among others.A browser-driver then executes these scripts on a browser-instance on your device.

So basically, it is a collection of tools, each of which caters to a specific organization’s Selenium QA testing requirements. The following is a list of tools that incorporates within Selenium:

Selenium Integrated Development Environment (IDE)

  • Selenium Remote Control (RC).
  • Next is Selenium WebDriver.
  • Selenium Grid.

1. What is automation testing, and what are its advantages?

So Automation testing or Test Automation is a process of automating the manual testing process of an application or a system by using testing tools. In addition to this, these allow you to create scripts that executes repeatedly, generating detailed test reports of the application or system under test.

Advantages of Automated Testing are:

  • It supports both the performance and functional testing of an application or system.
  • Also It facilitates the execution of repeated test cases.
  • It allows the parallel execution of the test cases.
  • Also improves the accuracy and efficiency of the system by reducing the manual intervention of humans to generate test cases.
  • And it helps in testing a large scale test matrix.

2. What are the disadvantages of using Selenium as a testing tool?

The following are the disadvantages of using Selenium as a testing tool:

  • Tests web applications only: Selenium supports the testing of only web-based applications. Mobile applications, Captcha, and Barcode readers cannot be tested using Selenium unless integrated with third-party tools like Appium and TestNG.
  • No built-in reporting and test management facility: Selenium can generate reports only using third-party tools like TestNG or JUnit.
  • Unavailability of reliable tech support: Since Selenium is an open-source tool, no dedicated support for user issues is available.
  • May require the knowledge of programming languages: Some prior programming knowledge is required to use Selenium.

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

The language used for writing test scripts in Selenium IDE is called Selenese. Moreover it is a set of commands used to test your web application or system. So Selenium commands could be divided into 3 major categories:

  • Actions: These are the commands interacting directly with web applications.
  • Accessors: These are the commands which allow users to store values to a user-defined variable.
  • Assertions: They enable a comparison of the current state of the application with its expected state.

4. State the major difference between “assert” and “verify” commands in Selenium.

Both “assert” and “verify” commands check whether the given condition is true or false and the only difference between them is that:

  • Assert: Assert condition stops the execution of the testing if the given condition is false else would continue with the further tests.
  • Verify: Verify the condition doesn’t stop the flow of execution irrespective of the condition being true or false.

5. What is an XPath?

XPath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. In addition to this it stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, XPath can be used to locate HTML elements.

The fundamental behind locating elements using XPath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.

6. What is the difference between “/” and “//” in Xpath?

Single Slash “/” – Single slash is use to create Xpath with absolute path i.e. xpath’s creation is there in order to start selection from the document node/start node.

Double Slash “//” – Double slash is use to create Xpath with relative path i.e. the xpath’s creation is there in order to start selection from anywhere within the document.

7. What are the different types of waits available in WebDriver?

So there are two types of waits available in WebDriver:

  1. Implicit Wait
  2. Explicit Wait

Implicit Wait: Implicit waits are use to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script. Thus, the subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command.

Explicit Wait: Explicit waits are use to halt the execution till the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applicable for a particular instance only.

8. How can you find if an element in displayed on the screen?

WebDriver facilitates the user with the following methods to check the visibility of the web elements. So these web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.

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


boolean buttonPresence = driver.findElement(“gbqfba”)).isDisplayed();


boolean buttonSelected = driver.findElement(“gbqfba”)).isSelected();


boolean searchIconEnabled = driver.findElement(“gbqfb”)).isEnabled();

9. When do we use findElement() and findElements()?

findElement() is use to find the first element in the current web page matching to the specified locator value. Take a note that only first matching element would be fetch.


WebElement element = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

findElements() is there to find all the elements in the current web page matching to the specific locator value. Take a note that all the matching elements would be fetch and stored in the list of WebElements.


List <WebElement> elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

10. What is the difference between driver.close() and driver.quit command?

close(): WebDriver’s close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently access by the WebDriver. The command neither requires any parameter nor does it return any value.

: Unlike close() method, quit() method closes down all the windows that the program has opened. Same as close() method, the command neither requires any parameter nor does is return any value.

11. Can Selenium handle windows based pop up?

Evidently selenium is an automation testing tool which supports only web application testing. Therefore, windows pop up cannot be handle using Selenium.

12. How can we handle web-based pop-up?

So basically WebDriver offers the users a very efficient way to handle these pop-ups using Alert interface. Evidently there are the four methods that we would be using along with the Alert interface.

  • void dismiss() – The dismiss() method clicks on the “Cancel” button as soon as the pop-up window appears.
  • void accept() – The accept() method clicks on the “Ok” button as soon as the pop-up window appears.
  • String getText() – The getText() method returns the text displayed on the alert box.
  • void sendKeys(String stringToSend) – The sendKeys() method enters the specified string pattern into the alert box.


// accepting javascript alert
                Alert alert = driver.switchTo().alert();

13. How can we handle windows based pop up?

So selenium is an automation testing tool which supports only web application testing, that means, it doesn’t support testing of windows based applications. However Selenium alone can not help the situation but along with some third-party intervention, this problem can be overcome. Moreover there are several third-party tools available for handling window based pop-ups along with the selenium like AutoIT, Robot class etc.

14. What is a framework?

So basically a framework is a constructive blend of various guidelines, coding standards, concepts, processes, practices, project hierarchies, modularity, reporting mechanism, test data injections etc. to pillar automation testing.

15. Differentiate between findElement() and findElements() in the context of Selenium with proper examples.

Following table lists the differences between findElement() and findElements() in Selenium :

The first web element that matches the locator is returned.It gives you a list of all the web items that match the locator.
If there are no matching web elements, a NoSuchElementException is produced.If there are no matching elements, an empty list is returned.
Syntax − WebElement button = webdriver.findElement(“<<Name value>>”));Syntax − List<WebElement> buttons = webdriver.findElements(“<<Name value>>”));

So these were some of the most frequent Selenium Interview Questions and answer. Hope this proves helpful to you in your preparation.  However,  we suggest to further explore Selenium in order to gain a better understanding of the technology.

Similar articles – Selenium Interview Questions and answer

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top