Top 34 Selenium Interview Questions Of 2019

415 0

In today’s digital era, there is a lot of dependency on the web. This necessitates the need for updated and well-functioning web applications. This is where Selenium comes into picture. Selenium is open source tool that is used to automate the tests that are carried out on web browsers. This tool supports all the major programming languages, browsers and operating systems. Companies such as Google, Netflix, Fitbit, HubSpot and many more uses Selenium today.

As you might already know, Manual testing consumes too much time and also tends to get tedious and filled with errors. This has given rise to the need to automate testing and in turn, to the increased need for Selenium automation testers.So, why Selenium and not any other automation testing tool? The main reason for this is because Selenium is an open source tool, which means that it is easy to adopt. This has caused Selenium to be increasingly considered as one of the top web testing tools.

 

As testing is the best way for professionals from any domain to enter into IT, gaining a Selenium certification can do wonders for your career. In this article, I have compiled the most frequently asked Selenium interview questions which can help if you are planning to enter into a career in the testing domain.

1. What do you understand by Automation Testing?

Automation testing refers to the process by which an application or software is tested with the help of an automation testing tool in order to identify the defects.

In this process, automation tools automatically executes the test scripts and generates the results. This is needed particularly when there is are lots of regression test cases. Some of the most popular automation testing tools are Selenium WebDriver, HP QTP/UFT and the like.

2What are some of the advantages of Automation Testing?

Some of the benefits of automation testing are:

  • Makes Compatibility testing easier: Automation testing makes it possible to carry out parallel execution in the combination of various browser environments and OS
  • Economical and saves time: This is because you can perform automation testing faster
  • Enable code reusability: Once the code is created, it can perform end number of times with almost no maintenance
  • Makes reporting easier: It automatically generates reports after test execution
  • It is versatile, powerful and more reliable
  • It requires very less or no manual intervention
  • It helps the user to integrate with Jenkins, Github and Cross browser testing tools
  • It enables maximum test coverage

3.  Define Selenium?

Selenium is an open source automated testing suite that is used for web application testing. It is compatible across different browsers and platforms.
Selenium is a set of various software tools, each with a different way of supporting web based automation testing.

4. What are the components of selenium

It has 4 types of components. They are:

  • Selenium WebDriver
  • Selenium IDE (Selenium Integrated Development Environment)
  • Selenium Grid
  • Selenium RC (Selenium Remote Control)

 

5. Mention the limitations of using Selenium WebDriver

Some of the challenges that users face while using Selenium WebDriver are:

  • Testing windows application and mobile application is not possible
  • Reporting is limited
  • It is tough to handle page load, captcha, pop up windows and dynamic elements

 

6. Explain Framework

A framework refers to a set of rules that we can follow to achieve the desired outcome. There are various kinds of automation frameworks and they are Keyword-Driven Testing Framework, Data Driven Testing Framework, and Hybrid Testing Framework.

7. Do you have any experience creating your own framework?

 

Some of the ideal responses to the question are:

  • A beginners response: ‘No, I have not created any framework from the scratch. I have used the framework which is already available. I have experience in developing test cases with the help of the existing framework’
  • A beginner with sound knowledge on developing framework:’I have created framework along with the other automation testers in my organization’
  • An experienced tester: ‘Yes, I have experience in designing framework from the scratch’

8. What is the reason for your preference towards Selenium Automation Tool?

  • It has cross-browser compatibility
  • It is an open source tool and free
  • It is compatible across platforms
  • It boasts of a large user base and thus have a large community of those who can give assistance
  • It supports multiple programming languages such as C#, Python, Java, Php, Perl etc

 

9. What is Selenium IDE?

 

A firefox plugin, Selenium IDE (Integrated Development Environment) is the most simple framework in the Selenium suite. It enables the user to record the scripts and also playback it. However, Selenium WebDriver or Selenium RC is required for writing robust and advanced test cases.

10What is Selenese?

It is the language that is used for writing Selenium IDE’s test scripts.

11. Mention the browser that supports the use of Selenium IDE

The only browser that supports Selenium IDE use is Firefox.

12. What do you know about Selenium RC?

Selenium Remote Control(RC) is a library that was created for managing browsers. For a long time, it was the leading framework for testing as compared to the rest of Selenium product set.

Those who used Selenium RC for website testing were able to use the programming language of their preference such as Java, python, Ruby, Perl or PHP.

13. What do you know about Selenium WebDriver?

Selenium WebDriver which is also known as Selenium 2 is a browse automation framework that receives commands and then sends it to a browser. It performs this with the help of a browser specific driver and controls the driver by communicating directly with it. Selenium WebDriver supports programming languages such as  C#, Python, Java. Ruby, PHP, and Perl.

14. What do you know about Selenium Grid?

Selenium Grid is a tool that is used along with Selenium RC for running multiple tests on various machines against various browsers and operating systems at the same time.

To put it a little more clearly, it helps to simultaneously distribute the user’s text execution on multiple environments and platforms.

15. Mention the benefits of Selenium Grid

  • It enables multi-browser testing
  • It enables parallel execution of test cases, thus saving time required for test execution
  • It enables the users to perform test cases on multi-platform

16. In selenium Grid, what is a node?

Node, in selenium grid, refers to the machine that is attached to the hubh. Selenium Grid can have multiple nodes.

17.  What is a hub in Selenium Grid?

A hub, in selenium Grid, is a central point or a server controlling the test execution on various machines.

18. When is Selenium Grid used?

It is used to simultaneously execute different or same test scripts on multiple browsers and platforms in order to get distributed test execution.

19. Mention the kinds of WebDriver APIs that are available in Selenium

    1. Gecko Driver
    2. Firefox Driver
    3. Chrome Driver
    4. Opera Driver
    5. Internet Explorer Driver
    6. EventFiringWebDriver
    7. Safari Driver
    8. Android Driver
    9. iPhone Driver
    10. HTMLUnit Driver

20. Which is the fastest WebDriver implementation?

HTMLUnitDriver is the fastest implementation of WebDriver. This is because HTMLUnitDriver does not carry out tests in the browser.

21. Mention the Open-source Frameworks that are supported by Selenium WebDriver?

TestNG and JUnit

22. Mention the Operating Systems that are supported by Selenium WebDriver?

    1. Windows
    2. Apple
    3. Linux

23. Mention the programming languages that are supported by Selenium WebDiver

    1. Java
    2. Python
    3. C#
    4. PHP
    5. Ruby
    6. Perl

24.What are types of Locators available in Selenium?

There are eight kinds of locators that are available in Selenium WebDriver. They are:

    1. ClassName
    2. ID
    3. Name
    4. TagName
    5. CSS Selector
    6. PartialLinkText
    7. LinkText
    8. XPath

25.What do you know about an XPath?

An XPath is used for locating the elements. XPath enables the users in navigating through the attributes and elements an XML document for locating web elements like button, Image, checkbox, and textbox in a web page.

26.Compare “/” and “//”

Single Slash “/” – This is used for creating XPath with absolute path, meaning that an XPath will be build for starting selection from the start/node

Double Slash “//” – This is used for creating XPath with relative path, meaning that an XPath will be developed for starting selection from anywhere within the document.

27. How is Assert and Verify in Selenium different from each other?

Assert: In case the assert condition is true, the program control will perform the next test step and when the asset condition is false, the test execution will halt.

Verify: The test execution will not stop or halt even if the verify condition holds true or false.

 

28. What is the key difference between Relative Path and Absolute Path?

Relative XPath begins from any node that is in between the HTML page to the current element’s node and starts with a double forward slash(//)

Absolute XPath begins from from the root node and ends with coveted descendant element’s node and starts with a single forward slash(/)

29. How can you handle frame in WebDriver?

Users can use iframe(initial frame) to insert some other document inside the current HTML do or even to insert a web page into another web page by permitting nesting.

  • Choose the iframe by ID : driver.switchTo().frame(“ID of the frame“);
  • Use tagName to locate the iframe: driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
  • Use Index frame to locate the iframe: driver.switchTo().frame(0);
  • frame(Name of Frame): driver.switchTo().frame(“name of the frame”);

Choose the Parent Window: driver.switchTo().defaultContent();

30.How can you click on a hyperlink by using the linkText?

Use the command driver.findElement(By.linkText(“Google”)).click();, to identify the element by using link Text. Click on that element and then the user will be directed back to the corresponding page.

The link can also be accessed  by using the following command:driver.findElement(By.partialLinkText(“Goo”)).click();. This command identifies the element through substringing of the link that is given in the parenthesis and thereby the command partialLinkText() identifies the web element with the given substring and  clicks on it then.

31. What are the various kinds of navigation commands?

Following are some kinds of navigation commands:

  • navigate().forward() – This command enables the user to navigate to the next page with reference to the web browser’s history
  • navigate().back() – This command does not need any parameters and takes the user back to the previous webpage in the web browser’s history
  • navigate().to() – With this command, users can launch a new browser window and navigate to the given URL

navigate().refresh() – This command enables the users in refreshing the current web page there through reloading all the web browser elements

32. When should you use findElements() and findElement()?

Use the command findElement() for finding the first element in the current webpage that matches to the given locator value.

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

Use the command findElements() for finding all the elements in the current webpage that matches upto the given locator value.

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

33.What are the different ways of handling web based pop-ups?

WebDriver provides the users an efficient ways of dealing with web-based pop-ups with the help of Alert interface. There are also four methods that users can use alongside Alert interface. They are:

  • String getText()
  • void accept()
  • void sendKeys(String stringToSend)
  • void dismiss()

34. How can you identify more than one web element in the list?

There can be instances when the user comes across elements of the same kind such as images, multiple hyperlinks and the like that are arranged in a systematic manner. During such circumstances, users can use one kind of code to deal with such elements and this can be accomplished with the help of WebElement list.

 

 

 

Leave a Reply

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

CAPTCHA

*

About Vibhuthi Viswanathan

Vibhuthi is a an avid follower of the latest trends in the world of Technology. Her writing aims to engage and educate the readers on all things Tech. When she is not twirling with words and pauses at SpringPeople, she binge reads popular literature.

Posts by Vibhuthi Viswanathan