Top Selenium interview questions

   What is Selenium ?

Selenium is a popular & powerful open source testing tool for web application which enables to automate the operations functions like click, type, selection from drop down, radio button etc of the web page. Initially it was developed in Java Script and browser engineering like DHTML and Frames. Selenium supports famous browsers like Internet Explorer, Safari, Google Chrome, Mozilla Firefox, Opera etc..

    How to identify an element in Selenium?

A web page is turned into elements as HTML tags which are special identifiers or locators.
On a web page element, we can differentiate between locators and identifiers:
They are:
Xpath – Used very rarely
ID – common identifier, used in CSS / JS code, ID is used as identify of an element
Attribute – Used in many attributes of HTML tag to see the element
Linktext – To select the text.
Name – To find the name of the element.
CSS – To select CSS properties and its related elements.
Tag – Names can be tagged.
PartialLink Text – To select an element partial link can be used

    How can you test mobile applications by using Selenium?

Selenium doesn’t support testing of mobile phone applications. Its for web-based applications.

    What is the procedure to test barcode or captcha using Selenium?

For Captcha or barcode Selenium doesn’t support as of now.

    How is Selenium different from commercial browser automation tools?

Selenium is like a collection of documents available in many software languages like C#, java, ruby, python, php etc.

    What is the relation between Selenium IDE, Server, RC and WebDriver?

Selenium IDE is a plugin of Firefox.
Selenium Server is a separate java program
Selenium Remote Control (RC) is an API
WebDriver is an API for programming tests

    How can you stop selenium not to create temporary Firefox profiles via web driver?

Setup the webdriver, firefox profile and name the profile for use, its ok if it uses cookies and cache

    How does the WebDriver get HTTP Response Code?

If the Selenium tests done on any modern browser the easiest way is to get the response code and send a synchronous XMLHttpRequest and verify the status of the response

    How to control the speed and pause test execution in Selenium IDE?

A slider with Slow & Fast pointers are available in Selenium IDE to control speed of execution.

    Where are the results of Test Execution in Selenium IDE are shown?

It is in the log window in Selenium IDE.

    Where are the descriptions of commands seen in Selenium IDE?

It’s in the Reference section.

    How to build a test suite in Selenium IDE?

Individual test cases can be recorded, grouped in a test suite.

    What are the verification points available with Selenium?

There are three types of verification points in selenium. They are :

  • Check for page title
  • Check for certain text
  • Check for certain element –textbox, table, drop down etc

    Which language is available in Selenium IDE?

HTML sort of language also known as Selenese along with other languages — c#, Java, php etc. can be used with Selenium IDE,

    Explain navigation commands and it types?

Following are the navigation commands:
navigate().back() – The above command requires no parameters and takes back the user to the previous webpage in the web browser’s history.

Sample code:
driver. navigate().back();
navigate().forward() – This command lets the user to navigate to the next web page with reference to the browser’s history.

Sample code:
driver. navigate().forward();
navigate().refresh() – This command lets the user to refresh the current web page there by reloading all the web elements.

Sample code:
driver. navigate().refresh();
navigate().to() – This command lets the user to launch a new web browser window and navigate to the specified URL.

Sample code:
driver. navigate().to(“https://google.com”);

  What is meant by Junit?

JUnit is a Java based testing framework introduced by Apache.

    What are JUnit annotations and also name a few JUnit Annotations?

Few are the JUnit Annotations:
@Test
@Before
@After
@BeforeClass
@AfterClass
@Ignore

  Which is a better TestNG JUnit?

TestNG is an advanced framework to benefit developers and also testers.
JUnit got huge popularity in Java applications, Java’s developers and testers code quality is enhanced.
JUnit has few strong limitations which are overcome in TestNG. TestNG being an open source framework which by Apache Software License and is free to download.

The TestNG is much superior to JUnit because:

  • Has advance and very easy annotations
  • Can set the Execution patterns very easily
  • Can also perform Concurrent test execution scripts
  • Set up of Test case dependencies is very easy

  Can Windows pop up be handled by Selenium?

Selenium only tests on web applications. Hence, it is not possible to handle Windows pop up.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.