Selenium Interview Questions And Answers to help you prepare In 2019

access_time 2019-10-25T13:24:27.317Z face Interview Questions

The world today completely depends on the web, therefore, ensuring a 100% up-time has become the need of the hour. Also, the proper functioning of the web apps comes as a major part of the job. An automation testing tool, Selenium is precisely developed for that purpose only. In this article, we will be discussing the most frequently asked Selenium Interview Questions. Both freshers & experienced can benefit from them and easily get into the testing domain.

Que 1 - What are the different exceptions in Selenium WebDriver?

Exceptions in Selenium are almost similar to any other exceptions found in different programming languages. Here are the most common exceptions in Selenium:
TimeoutException: It is seen when the operation executed by the command isn't completed in the given time.
NoSuchElementException: It is seen when an element that has given attributes isn’t available on the web page
ElementNotVisibleException: It is seen when the element isn’t visible on the web page but it is present in Document Object Model.
StaleElementException: It is seen when the element is either no longer attached to the DOM or deleted.

Que 2 - What is the exception test in Selenium?

An exemption test is a special case that you expect will be tossed inside a test class. On the off chance that you have composed an experiment in such manner that it should toss an exemption, at that point you can utilize the @Test explanation and indicate which special case you will expect by referencing it in the parameters. Take a look at the example below: @Test(expectedException = NoSuchElementException.class)

Que 3 - Why and how will you use an Excel Sheet in your project?

The reason is that it very well may be utilized as an information source for tests. An Excel Sheet can likewise be utilized to store the informational collection while performing DataDriven Testing. These are the two principle explanations behind utilizing Excel sheets.

When you use the excel sheet as a data source, you can store the following:

Application URL for all environments: It specifies the URL of the environment where you would want to conduct the testing like testing environment or development environment or staging environment or QA environment or production/ pre-production environment.
User name and password credentials of different environments: Easily keep the access credentials of the various applications/situations in the excel sheet. You can store them in an encoded arrangement and at whatever point you need to utilize them, you can unravel them as opposed to leaving it plain and unprotected.
Test cases to be executed: All the test cases can be listed down in a column and in the next column, easily specify either Yes or No to show whether you want that test case to be ignored or executed.
The data for various iterations can be stored to be later performed in the tests when you plan to use the excel sheet for DataDriven Tests. For instance, at the time of testing the web page, various sets of input data that are required to be passed to the test box are easily stored in the excel sheet.

Que 4 - Define Page Object Model? What are its advantages?

Page Object Model is a structured design for making an Object Repository for web UI components. Each site page in the application is required to have it's own relating page class. The page class is accountable for finding the WebElements in that page and afterward perform activities on those WebElements.

The benefits of utilizing POM are:

  • Enables us to isolate activities and streams in the UI from Verification – improves code comprehensibility.
  • Since the Object Repository is autonomous of Test Cases, various tests can utilize a similar Object Repository
  • Reusability of code

Que 5 - Define Page Factory?

Page Factory gives an enhanced method to execute the Page Object Model. When we state it is enhanced, it alludes to the way that memory usage is generally excellent and furthermore the execution is done in an item situated way.
Page Factory is utilized to instate the components of the Page Object or instantiate the Page Objects itself. Explanations for components can likewise be made (and prescribed) as the depicting properties may not generally be elucidating enough to separate one article from the other.
The idea of isolating the Page Object Repository and Test Methods is pursued here moreover. Rather than utilizing 'FindElements', we use comments like @FindBy to discover WebElement, and initElements technique to introduce web components from the Page Factory class.
@FindBy can accept partialLinkText, tagName, name, id, CSS, linkText, className & xpath as attributes.

Que 6 - What are different types of frameworks?

The different types of frameworks are:
Data-Driven Framework:-
At the point when the whole test information is created from some external records like Excel, CSV, XML or some database table, at that point it is called Data-Driven structure.
Keyword Driven Framework:-
At the point when just the directions and tasks are written in various documents like an Excel worksheet, it is called Keyword Driven system.
Hybrid Framework:-
A blend of both the Data-Driven structure and the Keyword Driven system is known as the Hybrid system.

Que 7 - What are the important changes in upgrades in various Selenium versions?

There are only three suites of tools included in the v1 of Selenium –Selenium RC, Selenium IDE, and Selenium Grid. It is important to note that WebDriver was not present in Selenium v1 and was only introduced in v2 of Selenium. With the coming of WebDriver, Selenium RC became no longer in use. Although the older versions of RC are still available in the market, however, the support is not yet available. As of now, the v3 of Selenium is used which included IDE, WebDriver and Grid.
For recording and playback of the tests, IDE is used while WebDriver helps in testing dynamic web applications through a programming interface. On the other hand, Grid helps in conducting tests in remote host machines.