Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

In Selenium WebDriver, what is an Object Repository?

Answer»

Instead of HARD CODING element locator data in the scripts, the Object REPOSITORY is used to store the element locator data in a centralized location. To store all of the element LOCATORS, we create a property file (.properties), which acts as an object repository in SELENIUM WebDriver.

2.

What are some cases that Selenium WebDriver cannot automate?

Answer»

Some of the scenarios which we cannot automate are as follows:

  • SELENIUM WebDriver does not support bitmap comparison.
  • Using Selenium WebDriver to automate Captcha is not possible.
  • Using Selenium WebDriver, we are unable to READ bar codes.
  • Video streaming scenarios: Selenium will almost never be able to recognise video controllers. To some EXTENT, JavaScript Executor and flex UI selenium will work, although they are not COMPLETELY dependable.
  • Performance testing can be AUTOMATED, however, it's preferable to avoid using Selenium for performance testing.
3.

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

Answer»

The distinction between driver.findElement() and driver.findElements() commands is-

  • findElement() - Based on the locator supplied as an ARGUMENT, findElement() RETURNS a single WebElement which is found first. If no element is discovered, it throws the NoSuchElementException.

findElement() has the following syntax:

WebElement textbox = driver.findElement(By.id("textBoxLocator"));
  • findElements() - Based on the locator supplied as an argument, findElements(), on the other HAND, produces a list of WebElements that all satisfy the location value supplied. If no element is discovered, it does not THROW any exception and returns a list of ZERO elements.

findElements() has the following syntax:

List <WebElement> elements = element.findElements(By.id("value"));
4.

What are the differences between the methods driver.close() and driver.quit()?

Answer»

The functions of these two METHODS (driver.close and driver.quit) are nearly identical. Although both allow US to close a browser, there is a distinction.

  • To close the current WebDriver instance, USE driver.close(). 
  • To close all open WebDriver instances, use driver.quit().
5.

In Selenium WebDriver, what is the difference between driver.getWindowHandle() and driver.getWindowHandles()?

Answer»

The difference between the two is as follows:

  • driver.getWindowHandle() – This method RETURNS the CURRENT PAGE's handle (a unique IDENTIFIER).
  • driver.getWindowHandles() – This function returns a list of handles for all of the pages that are opened at that particular TIME.
6.

What is the difference between driver.get() and driver.navigate.to(“url”)?

Answer»

The DIFFERENCE between the two is as follows:

  • driver.get(): To OPEN a URL and have it wait for the entire page to load.
  • driver.NAVIGATE.to(): To navigate to a URL WITHOUT having to wait for the entire page to load.
7.

What is an alternative option to driver.get() method to open an URL in Selenium Web Driver?

Answer»

driver.navigate() can be USED instead. It is used for navigating forwards and BACKWARDS in a BROWSER.

8.

What will happen if I execute this command? driver.get(“www.interviewbit.com”) ;

Answer»

An EXCEPTION is triggered if the URL does not BEGIN with http or HTTPS. As a result, the HTTP protocol MUST be SENT to the driver.get() method.

9.

Is it necessary to use Selenium Server to run Selenium WebDriver scripts?

Answer»

SELENIUM Server is required when distributing Selenium WebDriver SCRIPTS for execution with Selenium Grid. Selenium Grid is a Selenium functionality that allows you to execute TEST cases on multiple machines on various platforms. You wish to execute your test cases on a remote machine because your local machine is running numerous applications. You will NEED to set up the remote server so that the test cases can run on it.

10.

Explain the following line of code.

Answer» WEBDRIVER driver = new FirefoxDriver();

 'WebDriver' is an interface, and we are generating a WebDriver OBJECT by instantiating a FirefoxDriver object (This object uses Firefox Driver to LINK the test CASES with the Firefox BROWSER).

11.

What is WebDriver's super interface?

Answer»

SearchContext is the SUPER INTERFACE of the WEBDRIVER.

12.

What open-source frameworks does Selenium WebDriver support?

Answer»

The following are the open-source frameworks SUPPORTED by the SELENIUM WebDriver:

  • TestNG: 
    • Cédric Beust designed TestNG, a TESTING framework for the Java programming language that was influenced by JUnit and NUnit. 
    • TestNG was created with the purpose of covering a wider range of TEST categories, including unit, functional, end-to-end, integration, and so on, with more robust and user-friendly functions.
  • JUnit: 
    • It is used for Unit Testing of various types of applications. 
13.

What programming languages does Selenium WebDiver support?

Answer»

The VARIOUS programming LANGUAGES that Selenium WEBDRIVER supports are as FOLLOWS:

  • Java
  • C#
  • Python
  • Ruby
  • Perl
  • PHP
14.

What are the different types of WebDriver Application Programming Interfaces in Selenium?

Answer»

The Various TYPES of WEBDRIVER APIs in Selenium are as follows:

  • Opera Driver
  • InternetExplorer Driver
  • Chrome Driver
  • Safari Driver
  • Android Driver
  • Firefox Driver
  • Gecko Driver
  • iPhone Driver
  • EventFiringWebDriver
  • HTMLUnit Driver.
15.

Is Selenium WebDriver an interface or a class?

Answer»

SELENIUM WebDriver is USUALLY a SET of methods defined by an INTERFACE. The browser-specific classes, on the other hand, provide an implementation of it by extending a class. AndroidDriver, ChromeDriver, FirefoxDriver, InternetExplorerDriver, SafariDriver, and others are some of the implementation classes.

16.

Is Selenium WebDriver a library?

Answer»

SELENIUM WEBDRIVER is a prominent free open-source library for AUTOMATING browsers and TESTING WEB applications. 

17.

What is Selenium WebDriver?

Answer»

SELENIUM WebDriver, also KNOWN as Selenium 2, is a BROWSER automation FRAMEWORK that accepts and sends commands to a browser to implement it. It has direct control over the browser because it communicates with it directly. Java, C#, PHP, Python, Perl, and Ruby are all supported by Selenium WebDriver.