Top 22 Selenium Interview Questions

Top 22 Selenium Interview Questions

1) What is the primary distinction between web-driver and RC?

The key distinction between Selenium RC and Webdriver is that when a page is loaded, Selenium RC injects javascript functions into browsers. Selenium Webdriver, on the other hand, uses the browser's built-in functionality to drive the browser.


2) What are some of the benefits of RC?

The following are some of the benefits of RC:

Can read and write data from and to.xls,.txt, and other formats.

It can handle dynamic objects as well as Ajax-based user interface elements.

For improved performance and flexibility, loops and conditions might be used.

Many programming languages and operating systems are supported.

Selenium RC can be used in any browser that supports JAVA scripts.


3) What is a framework, and what are the many types of frameworks accessible in RC?

A collection of libraries and other resources

The term "framework" refers to a set of classes that testers can use to automate test cases. Some of the frameworks available in RC are NUnit, JUnit, TestNG, Bromine, RSpec, and unittest.


4) How do we deal with pop-ups in RC?

To handle pop-ups in RC, use the selectWindow method to pick the pop-up window, and the windowFocus method to transfer control from the current window to the pop-up windows and conduct scripted actions.


5) What technological constraints are there while utilising Selenium RC?

Apart from the JavaScript constraint on "same origin policy," Selenium is also prohibited from testing anything that is not within the browser.


6) Can we use Selenium RC without Selenium Grid to run tests on two distinct browsers on the same operating system?

Yes, it is conceivable under some circumstances. You aren't making use of the JAVA testing framework. If you use the Selenium java client driver instead of the Java testing framework, TestNG allows you to do this. You can set tests to run in parallel and define two different tests, each using a different browser, by using the "parallel=test" element.


7) What is the benefit of using TestNG with Selenium RC?

You'll need a mechanism to run the tests from a command line process, results that tell you what happened, and flexibility in how you build your test suites if you want complete automation across many server and client platforms. This flexibility is provided by TestNG.


8) How do you use Selenium Server to capture server-side logs?

You can use the command to capture server side logs in Selenium Server.

Other than the usual port 4444, how can you start Selenium Server? java –jar.jar –log selenium.log


9)Other than the default port, you can start Selenium server on java-jar selenium-server.jar-port.

You can run Selenium server on java-jar selenium-server.jar-port other than its default port


10) How does the Selenium grid hub communicate with the RC slave machine?

The selenium grid hub continues to poll at a predetermined interval.

startpoint specifies where the execution should start. When you wish to run the testscript from the middle of the code or from a breakpoint, you can use startpoint.


11) Explain why Python is preferred over Java in Selenium.

There are a few advantages of using Python with Selenium versus Java.

When compared to Python programmes, Java programmes run slower.

To begin and finish blocks in Java, standard braces are used, whereas indentation is used in Python.

Python is dynamically typed, whereas Java uses static typing.

In comparison to Java, Python is simpler and more compact.


12) What are the difficulties in using Selenium Webdriver to handle Ajax calls?

Handling Ajax Calls in Selenium Webdriver presents a number of issues.

Using the "pause" command to handle Ajax calls is a good idea.

Not entirely dependable. The test becomes excessively slow and the testing time grows as a result of the long pause period. In order to test Ajax applications, "waitforcondition" will be more useful.

It's impossible to determine the level of risk connected with specific Ajax apps.

Giving developers complete control over Ajax applications complicates the testing process.

As a result, AJAX applications frequently employ multiple encoding or serialisation techniques to deliver POST data, making it challenging for testing tools to create automated test requests.


13) Explain what IntelliJ is.

Intellij is a Selenium IDE that helps you build better and faster code. Intellij can be used in conjunction with Eclipse and Java beans.


14) Explain how you can personalise the TestNG report.

In TestNG, you may personalise the report.

in two ways

Implementing the ITestListener Interface

How to Use the IReporter Interface


15) What Java API is necessary to generate PDF reports?

Java API IText is required to generate PDF reports.


16) Explain what Selenium WebDriver's Listeners are.

Listeners in Selenium WebDriver "listen" to the event defined in the selenium script and respond appropriately. It allows you to personalise TestNG reports and logs. WebDriver Listeners and TestNG Listeners are the two basic types of listeners.


17) What are the different sorts of listeners in TestNG?

In TestNG, there are three sorts of listeners:














18) What is the required capability? In terms of Selenium, how does it help?

The intended capability is a set of key/value pairs for storing the information.

The behaviour of the browser at run time is determined by browser properties such as the browser name, browser version, the path of the browser driver in the system, and so on.

In the case of selenium,

It can be used to set up the Selenium WebDriver driver instance.

When you need to execute the test cases in a different browser, on a different operating system, and on a different version of the software.


19) What API is required for database testing in Selenium Webdriver?

JDBC (Java Database Connectivity) API is required for database testing in Selenium Webdriver. You can use it to run SQL statements.


20) When should you use AutoIT?

Selenium is a tool for automating web-based applications across many browsers. However, AutoIT is required to manage the application's window GUI and non-HTML popups. learn more about using AutoIT with Selenium


21) Explain why you require Session Handling when using Selenium.

Session Handling is required while working with Selenium. This is because the Selenium WebDriver must constantly communicate with the browser to perform commands throughout test execution. It's also possible that, before the current execution completes, someone else on the same machine and using the same browser starts executing a different script. Session Handling is required to avoid such a predicament.


22) Describe the benefits of using Git Hub for Selenium.

The benefits of using Git Hub for Selenium are as follows:

When multiple people work on the same project, they can simultaneously change project data and tell other team members.

Jenkins can assist you in frequently building the project from the remote repository. This aids in the tracking of failed builds.

Follow Us on!

How can we help you?

To request a quote or want to meet up for a course discussion, contact us directly or fill out the form and we will get back to you promptly.