Selenium Interview Questions – 1




1. What is Automation Testing?

Automation Testing or Test Automation is a process of automating manual testing process to test the Application Under Test. Test Automation is the use of special software to control the execution of tests and the comparison of actual outcomes with predicted outcomes. Test Automation can automate some repetitive but necessary tasks in a formalized testing process already in place. Test automation is critical for Continuous Delivery and Continuous Testing.

2. What are the benefits of Automation Testing?

  • Supports Execution of Repeated Test Cases
  • Saves Time
  • Early Bug Detection
  • Re-usability
  • Distributed Test Execution
  • Improves Test Coverage
  • Improves Accuracy
  • Minimal Manual Intervention

3. What is Selenium WebDriver?

Selenium Webdriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using.

4. Why should Selenium be selected as a test tool?

  • It is free and open source
  • It has large user base and helping communities
  • It has cross Browser compatibility (Firefox, chrome, Internet Explorer, Safari etc.)
  • It has great platform compatibility (Windows, Mac OS, Linux etc.)
  • It supports multiple programming languages (Java, C#, Ruby, Python, Perl etc.)
  • It has fresh and regular repository developments
  • It Supports distributed testing
  • Support On Web
  • Support From Selenium
  • Integration with Other tools
  • Handles JavaScript Errors
  • It Simulates Human Actions
  • Can minimize the browser while executing and we can do our own work
  • It supports so many IDEs (famous is Eclipse for Java and Visual Studio for C#)
  • We can customize the selenium code if we have the programming skills

5. What are the challenges with Selenium?

  • Selenium supports ONLY WEB based applications.
  • As there is no object repository concept in Selenium, maintainability of objects becomes difficult
  • User is expected to have prior programming language knowledge
  • Captcha and Bar code readers cannot be tested using Selenium
  • No vendor support for tool compared to commercial tools like HP UFT
  • It does not support the Bitmap comparison. For this need to depend on third party API’s
  • Reports can only be generated using third party tools like TestNG or Junit
  • Uploading a file can not be automated using Selenium. Need to depends on third party tools like AutoIT or Sikuli




6. What are the testing types that can be supported by Selenium?

  • Functional Testing
  • Regression Testing

7. What are the different types of locators in Selenium Webdriver?

8. What is an XPath?

XPath (XML Path Language),  is a query language for selecting nodes from an XML document. The XPath language is based on a tree representation of the XML document, and provides the ability to navigate around the tree, selecting nodes by a variety of criteria. 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.

9. What is the difference between “/” and “//” in XPath?

Single Slash “/”Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.

Double Slash “//”Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document.

10. What are different types of Drivers available in Webdriver?

  • HtmlUnit Driver
  • Firefox Driver
  • Internet Explorer Driver
  • ChromeDriver
  • Opera Driver
  • iOS Driver
  • Android Driver
  • Safari Driver




11. What is Object Repository ?

Object Repository is a centralized location where we can store objects/Web elements information, it acts as interface between Test script and application in order to identify the objects/web elements during the execution.A basic object repository can be implemented as a collection of key-value pairs, with the key being a logical name identifying the object/web element and the value containing unique objects/web elements properties used to identify the object/web element on a screen. Selenium Webdriver offers no object repository implementation by default.

12. Which web driver implementation is fastest?

HtmlUnit Driver  is currently the fastest and most lightweight implementation of WebDriver. As the name suggests, this is based on HtmlUnit. HtmlUnit is a java based implementation of a WebBrowser without a GUI.

13. What is an Element in the Selenium Webdriver?

Usually an element is called as webelement in selenium webdriver. Everything what you see on a page is called webelement (ex: Textbox, button , link, dropdown, image etc…)

14. How you will find the Element in the Selenium Webdriver?

By using different type of locators we can find the webelement on the webpage uniquely.

15. What are the differences between “findElement” and “findElements”?

findElement()findElements()
It is used to find the first element in the current webpage with the specified matching locator.It is used to find all the elements in the current web page with the specified matching locator.
Return type of findElement() is WebElement.Return type of findElements() is List of WebElements.
If the web element is not available then it will throw "NoSuchElementException".If the web element/elements not available then it will return empty list.
Syntax:
WebElement element = driver.findElement(By.xpath(“<XPath Value>”));
Syntax:
List<WebElement> elements = driver.findElements(By.xpath(“<XPath Value>”));