Home Interview Questions Top 32 Selenium Interview Questions and Answers with PDF Download in 2019

Top 32 Selenium Interview Questions and Answers with PDF Download in 2019

Top 32 Selenium Interview Questions

Top 32 Selenium Interview Questions: Here are the top interview questions of Selenium. Be prepared for the interview. You can download the entire questions in a pdf format. so guys All the best for your interview.

1. What is Selenium?

Ans. Selenium is a robust test automation suite that is used for automating web based applications. It supports multiple browsers, programming languages and platforms.


2. What are different forms of selenium?

Ans. Selenium comes in four forms-

  • Selenium WebDriver – Selenium WebDriver is used to automate web applications using browser’s native methods.
  • Selenium IDE – A firefox plugin that works on record and play back principle.
  • Selenium RC – Selenium Remote Control(RC) is officially deprecated by selenium and it used to work on javascript to automate the web applications.
  • Selenium Grid – Allows selenium tests to run in parallel across multiple machines.

3. What are some advantages of Selenium?

Ans. Following are the advantages of Selenium-

  • Selenium is open source and free to use without any licensing cost.
  • It supports multiple languages like Java, ruby, python etc.
  • It supports multi browser testing.
  • It has good amount of resources and helping community over the internet.
  • Using selenium IDE component, non-programmers can also write automation scripts
  • Using selenium grid component, distributed testing can be carried out on remote machines possible.

You might like: Top 32 Node.js Interview Questions And Answers

4. What are some limitations of Selenium?

Ans. Following are the limitations of Selenium-

  • We cannot test desktop application using Selenium.
  • We cannot test web services using Selenium.
  • For creating robust scripts in Selenium Webdriver, programming language knowledge is required.
  • We have to rely on external libraries and tools for performing tasks like – logging(log4J), testing framework-(testNG, JUnit), reading from external files(POI for excels) etc.

5. Which all browsers/drivers are supported by Selenium Webdriver?

Ans. Top 32 Selenium Interview Questions:

  • Some commonly used browsers supported by Selenium are-
  • Google Chrome – ChromeDriver
  • Firefox – FireFoxDriver
  • Internet Explorer – InternetExplorerDriver
  • Safari – SafariDriver
  • HtmlUnit (Headless browser) – HtmlUnitDriver
  • Android – Selendroid/Appium
  • IOS – ios-driver/Appium

6. What is test automation or automation testing?

Automation testing enables the use of specialized tools to automate the execution of manually designed test cases without any human intervention. Automation testing tools can access the test data, controls the execution of tests and compares the actual result against the expected result. Consequently, generating detailed test reports of the system under test.

7. What are the advantages of automation testing?

Automation testing supports both functional and performance test on an application.

  • It supports the execution of repeated test cases.
  • It facilitates parallel execution.
  • It aids in testing a large test matrix.
  • It improves accuracy because there are no chances of human errors.
  • It saves time and money.

8. Name some of the commonly used Automation Testing tools that are used for Functional Automation.

  • Quick Test Professional, provided by HP.
  • Rational Robot, provided by IBM.
  • Coded UI, provided by Microsoft.
  • Selenium, open source.
  • Auto It, Open Source.

9. Name some of the commonly used Automation Testing tools that are used for Non-Functional Automation.

  • Load Runner, provided by Hp.
  • JMeter, provided by Apache.
  • Burp Suite, provided by PortSwigger.
  • Acunetix, provided by Acunetix.

10. List some of the test types that are supported by Selenium.

Selenium supports two types of testing:

  • Functional Testing
  • Regression Testing
  • Sanity Testing
  • Smoke Testing
  • Responsive Testing
  • Cross Browser Testing
  • UI testing (black box)
  • Integration Testing

11. What do you mean by Selenese?

Top 32 Selenium Interview Questions: Selenium commands, also known as “Selenese” are the set of commands used in Selenium that run your tests. For example, command – open (URL); launches the desired URL in the specified browser and it accept both relative and absolute URLs.

A sequence of Selenium commands (Selenese) together is known as a test script.

12. What are the different ways of locating a web element in Selenium?

In Selenium, web elements are identified and located with the help of Locators. Locators specify a target location which uniquely defines the web element in the context of a web application. Thus, to identify web elements accurately and precisely we have different types of locators in Selenium:

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

13. How many types of WebDriver API’s are available in Selenium?

The list of WebDriver API’s which are used to automate browser include:

  • AndroidDriver
  • ChromeDriver
  • EventFiringWebDriver
  • FirefoxDriver
  • HtmlUnitDriver
  • InternetExplorerDriver
  • iPhoneDriver
  • iPhoneSimulatorDriver
  • RemoteWebDriver

14. List out some of the Automation tools which could be integrated with Selenium to achieve continuous testing.

Top 32 Selenium Interview Questions: Selenium can be used to automate functional tests and can be integrated with automation test tools such as Maven, Jenkins, & Docker to achieve continuous testing. It can also be integrated with tools such as TestNG, & JUnit for managing test cases and generating reports.

15. What do you mean by the assertion in Selenium?

The assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are “assert”, “verify” and “waitFor”.

16. How can we move to parent of an element using XPath?

Ans. Using ‘..’ expression in XPath we can move to parent of an element e.g. the locator //div[@id=”childId”]/.. will move to the parent of the div element with id value as ‘childId’.

17. How can we move to nth child element using XPath?

Ans. There are two ways of navigating to the nth element using XPath-

  • Using square brackets with index position-
    Example – div[2] will find the second div element.
  • Using position()-
    Example – div[position()=3] will find the third div element.

18. What is the syntax of finding elements by class using CSS Selector?

Ans. By .className we can select all the element belonging to a particluar class e.g. ‘.red’ will select all elements having class ‘red’.

19. What is the syntax of finding elements by id using CSS Selector?

Ans. By #idValue we can select all the element belonging to a particluar class e.g. ‘#userId’ will select the element having id – userId.

20. How can we select elements by their attribute value using CSS Selector?

Ans. Using [attribute=value] we can select all the element belonging to a particluar class e.g. ‘[type=small]’ will select the element having attribute type of value ‘small’.

21. What are the WebDriver supported Mobile Testing Drivers?

WebDriver supported “mobile testing drivers” are:

  • AndroidDriver
  • IphoneDriver
  • OperaMobileDriver

22. What are the popular programming languages supported by Selenium WebDriver to write Test Cases?

23. What is the difference between type keys and type commands?

TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won’t.

24. What is the difference between “type” and “typeAndWait” command?

Top 32 Selenium Interview Questions: “type” command is used to type keyboard key values into the text box of software web application. It can also be used for selecting values of combo box whereas “typeAndWait” command is used when your typing is completed and software web page start reloading. This command will wait for software application page to reload. If there is no page reload event on typing, you have to use a simple “type” command.

25. What is the difference between findElement() and findElements()?

findElement(): It is used to find the first element within the current page using the given “locating mechanism”. It returns a single WebElement.

findElements(): It uses the given “locating mechanism” to find all the elements within the current page. It returns a list of web elements.

26. Write a code snippet to launch Firefox browser in WebDriver.

 publicclassFirefoxBrowserLaunchDemo {  
publicstaticvoid main(String[] args) {  
//Creating a driver object referencing WebDriver interface  
WebDriver driver;  
//Setting webdriver.gecko.driver property  
System.setProperty("webdriver.gecko.driver", pathToGeckoDriver + "\\geckodriver.exe");  
//Instantiating driver object and launching browser  
driver = newFirefoxDriver();  
//Using get() method to open a webpage  
//Closing the browser  

27. Write a code snippet to launch Chrome browser in WebDriver.

 publicclassChromeBrowserLaunchDemo {  
publicstaticvoid main(String[] args) {  
//Creating a driver object referencing WebDriver interface  
WebDriver driver;  
//Setting the webdriver.chrome.driver property to its executable's location  
System.setProperty("webdriver.chrome.driver", "/lib/chromeDriver/chromedriver.exe");  
//Instantiating driver object  
driver = newChromeDriver();  
//Using get() method to open a webpage  
//Closing the browser  

28. Write a code snippet to launch Internet Explorer browser in WebDriver.

 publicclassIEBrowserLaunchDemo {  
publicstaticvoid main(String[] args) {  
//Creating a driver object referencing WebDriver interface  
WebDriver driver;  
//Setting the webdriver.ie.driver property to its executable's location  
System.setProperty("webdriver.ie.driver", "/lib/IEDriverServer/IEDriverServer.exe");  
//Instantiating driver object  
driver = newInternetExplorerDriver();  
//Using get() method to open a webpage  
//Closing the browser  

29. Write a code snippet to perform right-click an element in WebDriver.

We will use Action class to generate user event like right-clicking an element in WebDriver.

 Actions action = newActions(driver);  
WebElement element = driver.findElement(By.id("elementId"));  

30. Write a code snippet to perform mouse hover in WebDriver.

 Actions action = newActions(driver);  
WebElement element = driver.findElement(By.id("elementId"));  

31. How do you perform drag and drop operation in WebDriver?

Top 32 Selenium Interview Questions: Code snippet to perform drag and drop operation:

 //WebElement on which drag and drop operation needs to be performed  
WebElementfromWebElement = driver.findElement(By Locator of fromWebElement);  
//WebElement to which the above object is dropped  
WebElementtoWebElement = driver.findElement(By Locator of toWebElement);  
//Creating object of Actions class to build composite actions  
Actions builder = newActions(driver);  
//Building a drag and drop action  
Action dragAndDrop = builder.clickAndHold(fromWebElement)  
//Performing the drag and drop action  

32. What are the different methods to refresh a web page in WebDriver?

There are multiple ways of refreshing a page in WebDriver.

 1. Using driver.navigate command -
 2. Using driver.getCurrentUrl() with driver.get() command -
 3. Using driver.getCurrentUrl() with driver.navigate() command -
 4. Pressing an F5 key on any textbox using the sendKeys command -
 driver.findElement(By textboxLocator).sendKeys(Keys.F5);  
 5. Passing ascii value of the F5 key, i.e., "\uE035" using the sendKeys command -
 driver.findElement(By textboxLocator).sendKeys("\uE035");   

Top 32 Selenium Interview Questions and Answers with PDF Download in 2019

Check out Latest Posts: