Home >>Interview Questions >Selenium Interview Questions and Answers

Selenium Interview Questions and Answers

Selenium Interview Questions

Selenium is focused on automating web applications for testing purposes, though definitely not on it alone. Administration tasks based on the Web can also be automated. It makes browsers automated

1.What is test automation or automation testing?

Automation testing uses automation tools to write and perform test cases, the implementation of an automated test suite requires no manual involvement. Testing prefer to submit check scripts and test cases using automation tools and then organize them into test suites.

Automation testing requires the usage of specialized tools to facilitate the implementation without any human involvement of manually crafted test cases. Automation testing tools may view test data, control test execution and evaluate the real result to the predicted outcome. Detailed test reports of the system under test are generated accordingly.

2. What are the advantages of automation testing?

Any specific Automation testing advantages are as follows.

  • Automation software facilitates practical as well as performance testing on an application.
  • It assists in carrying out repeated test cases.
  • It makes parallel execution easier.
  • It helps have a broad research matrix tested.
  • This increases accuracy because there is no risk of human error.
  • It's a time and money saver.

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

The following are examples of top 10 automation testing methods used for Functional Automation.

  • Teleric Test Studio, Developed by Teleric.
  • TestingWhiz
  • HPE Unified Functional Testing (HP - UFT formerly QTP)
  • Auto It, Open Source.
  • Tosca Testsuite
  • Rational Robot, provided by IBM.
  • Watir
  • Quick Test Professional, provided by HP.
  • Coded UI, provided by Microsoft.
  • Selenium, open source.

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

Lists of several commonly used Non-Functional Automation Research tools are as follows.

  • Load runner, given by Hp.
  • JMeter, Apache gives
  • Burp Suite, made available from PortSwigger.
  • Acunetix, available through Acunetix.

5. What is Selenium?

Selenium is a portable, software testing framework. Selenium tool facilitates the authoring of functional tests using a retrieval tool, without the need to know a language of test scripting.

Selenium is one of the most widely used testing suite for the implementation of open source Web UI (User Interface). At Thinking Functions, Jason Huggins invented selenium as an internal tool in 2004. Selenium facilitates development through various languages such as browsers, platforms and programming.

6. What are the different components of Selenium?

Selenium is not only a single tool but a series of software, each of which has a particular approach to support research automation. It comprises four main components including:

  • Selenium Integrated Development Environment (IDE)
  • Remote control over selenium (Now Deprecated)
  • WebDriver
  • Selenium Control Grid

7. List out the names of programming languages, browsers and operating systems that are supported by Selenium

Selenium supports different operating systems, browsers, and languages. Here is the list:

  • Languages of Programming: C #, Java, Python , PHP, Ruby, Perl, JavaScript.
  • Operating Systems: Android, Mac, Solaris, iOS, Windows, Linux.
  • Browsers: Google Chrome, Internet Explorer, Mozilla Firefox, Edge, Opera , Safari, etc.

8. What are the significant changes/upgrades in various Selenium versions?

V1.0 selenium:

  • Initial release of selenium was version 1.0.
  • Three tools were included: Selenium IDE, Selenium RC, and Selenium Grid.

Selenium v2.0:

  • Selenium WebDriver replacing selenium RC was released in version "2.0."
  • RC got discontinued with the onset of WebDriver, and moved to the legacy kit.

Selenium v3:

  • Selenium 3 has new functionality and functionalities applied to the current version.
  • This contains Selenium IDE, WebDriver selenium and Selenium Grid.

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

There are different types of tests we can perform by Selenium.

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

10. What is Selenium IDE?

Selenium IDE is implemented as an extension to Firefox which provides recording and playback functionality on test scripts. It enables testers to export recorded scripts in a variety of languages, including HTML, Java, Ruby, RSpec, Python, C #, JUnit and TestNG.

Selenium IDE has limited reach, and the test scripts produced are not very sturdy and portable.

11. What do you mean by Selenese?

Selenium commands, also known as "Selenese," are the set of commands that run your tests in selenium. For eg, in the specified browser, command-open (Link); launches the desired Link and accepts relative and absolute URLs.

A series of Selenium (Selenese) commands together is regarded as a test script.

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

Web components are identified and placed in Selenium, using Locators. In the context of a web application, locators specify a target location that defines the web element in a unique way. Therefore we have different types of locators in Selenium to classify web elements correctly and precisely:

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

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
  • FirefoxDriver
  • iPhoneSimulatorDriv
  • ChromeDriver
  • HtmlUnitDriver
  • EventFiringWebDriv
  • InternetExplorerDriver
  • iPhoneDriver
  • RemoteWebDriver

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

Selenium can be used to simplify functional testing, and it can be combined with automation testing techniques such as Maven, Jenkins, & Docker for continuous testing. It may also be combined with techniques like TestNG, & JUnit to handle test cases and generating reports.

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

The assertion acts as a point of verification. This verifies that the application condition is in keeping with what is expected. The statement types are "assert," "verified" and "waitFor ».

16.Explain the difference between assert and verify commands?

Assert: Assert control checks whether the condition given is true or false. If the condition is true, the control of the program will perform the next testing phase, and if the condition is false, the execution will stop and nothing will be executed.

Verify: Verify command often checks for valid or false condition. It does not stop execution of the program, i.e., any failure during verification would not stop execution, and all phases of the test would be executed.

17.What is the difference between "/" and "//" in XPath?

Single Slash "/": Single slash is used to create XPath with absolute path.

Double Slash "//": Double slash is used to create XPath with the relative path.

18. What are the different types of annotations which are used in Selenium?

JUnit annotations which can be used are:

After

Test

Before

Ignore

AfterClass

BeforeClass

RunWith

19. What are the WebDriver supported Mobile Testing Drivers?

WebDriver supported "mobile testing drivers" are:

IphoneDriver

AndroidDriver

OperaMobileDriver

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

Selenium WebDriver supports the below languages to write Test Cases.

  • C#
  • PHP
  • JAVA
  • Python
  • Ruby
  • Perl

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

In certain instances TypeKeys() will cause JavaScript event whereas.type() does not.

22.What is the difference between "type" and "typeAndWait" command?

The command "type" is used to enter key values into the software network application text box. This may also be used to select combo box numbers, whereas the command "typeAndWait" is used until the typing is complete and the reloading of the software web page starts. This command must wait to be reloaded to the software application page. If no page reload event occurs while typing, using a simple "type" command.

23.What is the wait? How many types of waits in selenium?

Selenium Webdriver incorporates the idea of the waits for the client dependent on AJAX. There are two kinds of warts:

Implicit Wait

Explicit Wait

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

Findelement(): It uses the specified "location mechanism" to find the first item within the current page. A single WebElement returns.

Findelements(): It uses the "location mechanism" provided to locate all of the elements inside the current page. It returns a list of elements within the web.

25. What is Selenium Grid?

The Selenium Grid helps you to seamlessly spread the results on multiple machines and on all of them. Ok, you can use the same text file to run Internet Explorer checks on Windows and Safari on Mac machine. This reduces test time and offers fast feedback.

26. How can we launch different browsers in Selenium WebDriver?

We need to create a driver instance of that particular browser.

WebDriver driver =newFirefoxDriver();  

"WebDriver" is an interface here, so we're building a WebDriver-type reference variable "driver," instantiated with the "FireFoxDriver" class.

27. What is the main disadvantage of implicit wait?

Implicit waiting main drawback is that it slows down test performance.

One other implicit disadvantage of waiting is:

Suppose you set the waiting limit to 10 seconds, and in 11 seconds the elements appear in the DOM, the tests would fail as you asked it to wait a maximum of 10 seconds.

28. What are the benefits of Automation Testing?

The Automation Testing results are as follows.

  • It allows multiple test cases to be performe
  • This requires parallel execution of
  • Evaluation software facilitates spontaneous implementation
  • This allows for greater accuracy. It thus reduces errors generated by humans
  • It's a time and money saver.

29. How can we get a text of a web element?

Get command is used to get the web element specified inside text. The get command requires no parameters but returns a value of the string type. This is also one of the commonly used commands from web pages for verifying messages, labels, and errors, etc.

Syntax:

String Text = driver.findElement(By.id("Text")).getText();  

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

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

Actions action = newActions(driver); 

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

action.contextClick(element).perform();  

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

Actions action = newActions(driver);  

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

action.moveToElement(element).perform();  

32. What is the difference between "/" and "//" in XPath?

Single Slash "/":Single slash is used to create XPath with absolute path.

Double Slash "//":Double slash is used to create XPath with the relative path.

33. What do you mean by XPath?

XPath is often connected to XML Path. It is a term used to access documents using XML. The standardization of elements in Selenium is an important approach. XPath is an interpretation of the path, together with other conditions. Here we can compose XPath script / query easily to find some item on the webpage. It is developed to allow XML documents to be browsed. The main considerations it considers when exploring are the collection for particular handling of individual elements, attributes or some other aspect of an XML text. It's also developing accurate locators. Some other points concerning XPath are as follows.

  1. XPath is a language which is used to find nodes in XML document
  2. XPath may be used as a replacement if the item you want to find doesn't have a suitable Id or name attribute.
  3. XPath offers methods for finding such as:
  • An Absolute XPath
  • Attributes on XPath