Latest Selenium Interview Questions and Answers

Read Top Selenium Interview Questions and Answers Experienced, Freshers for Job Interview Quiz with Solutions.

How will you handle working with multiple windows in Selenium ?

We can use the command selectWindow to switch between windows. This command uses the title of Windows to identify which window to switch to.

How will you verify the specific position of an web element

You can use verifyElementPositionLeft & verifyElementPositionTop. It does a pixel comparison of the position of the element from the Left and Top of page respectively

How can you retrive the message in an alert box ?

You can use the storeAlert command which will fetch the message of the alert pop up and store it in a variable.

What is selenium RC (Remote Control)?

Selenium IDE have limitations in terms of browser support and language support. By using Selenium RC limitation can be diminished.

  • On different platforms and  different web browser for automating web application  selenium RC is used with languages like Java, C#, Perl, Python

  • Selenium RC is a java based and using any language it can interact with the web application

  • Using server you can bypass the restriction and run your automation script running against any web application

Why Selenium RC is used?

Selenium IDE does not directly support many functions like condition statements, Iteration, logging and reporting of test results, unexpected error handling and so on as IDE supports only HTML language.  To handle such issues Selenium RC is used  it supports the language like Perl, Ruby, Python, PHP using these languages we can write the program to achieve the IDE issues.

What is the main difference between web-driver and RC ?

The main difference between Selenium RC and Webdriver is that, selenium RC injects javascript function into browsers when the page is loaded. On the other hand, Selenium Webdriver drives the browser using browsers built in support

What are the advantages of RC?

Advantages of RC are

  • Can read or write data from/ to .xls, .txt, etc

  • It can handle dynamic objects and Ajax based UI elements

  • Loops and conditions can be used for better performance and flexibility

  • Support many Programming languages and Operating Systems

  • For any JAVA script enabled browser Selenium RC can be used

What is framework and what are the frameworks available in RC?

A collection of libraries and classes is known as Framework and they are helpful when testers has to automate test cases. NUnit, JUnit, TestNG, Bromine, RSpec, unittest are some of the frameworks available in RC .

How can we handle pop-ups in RC ?

To handle pop-ups in RC , using selectWindow method, pop-up window will be selected and windowFocus method will let the control from current window to pop-up windows and perform actions according to script

What are the technical limitations while using Selenium RC?

Apart from “same origin policy” restriction from js, Selenium is also restricted from exercising anything that is outside browser.

Can we use Selenium RC to drive tests on two different browsers on one operating system without Selenium Grid?

Yes, it is possible when you are not using JAVA testing framework.  Instead of using Java testing framework if you are using java client driver of selenium then TestNG allows you to do this.  By using “parallel=test” attribute you can set tests to be executed in parallel and can define two different tests, each using different browser.

Why to use TestNG with Selenium RC ?

If you want full automation against different server and client platforms, You need a way to invoke the tests from a command line process, reports that tells you what happened and flexibility in how you create your test suites. TestNG gives that flexibility.

How you can capture server side log Selenium Server?

To capture server side log in Selenium Server, you can use command

  • java –jar .jar –log selenium.log

Other than the default port 4444 how you can run Selenium Server?

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

How Selenium grid hub keeps in touch with RC slave machine?

At predefined time selenium grid hub keeps polling all RC slaves to make sure it is available for testing.  The deciding parameter is called “remoteControlPollingIntervalSeconds” and is defined in “grid_configuration.yml”file

Using Selenium how can you handle network latency ?

To handle network latency you can use driver.manage.pageloadingtime for network latency

To enter values onto text boxes what is the command that can be used?

To enter values onto text boxes we can use command sendkeys()

How do you identify an object using selenium?

To identify an object using Selenium you can use

isElementPresent(String locator)

isElementPresent takes a locator as the argument and if found returns a Boolean

In Selenium what are Breakpoints and Startpoints?

  • Breakpoints: When you implement a breakpoint in your code, the execution will stop right there. This helps you to verify that your code is working as expected.

  • StartpointsStartpoint indicates the point from where the execution should begin. Startpoint can be used when you want to run the testscript from the middle of the code or a breakpoint.

Mention why to choose Python over Java in Selenium?

Few points that favor Python over Java to use with Selenium is,

  • Java programs tend to run slower compared to Python programs.

  • Java uses traditional braces to start and ends blocks, while Python uses indentation.

  • Java employs static typing, while Python is dynamically typed.

  • Python is simpler and more compact compared to Java.

What are the challenges in Handling Ajax Call in Selenium Webdriver?

The challenges faced in Handling Ajax Call in Selenium Webdriver are

  • Using “pause” command for handling Ajax call is not completely reliable. Long pause time makes the test unacceptably slow and increases the testing time. Instead, “waitforcondition” will be more helpful in testing Ajax applications.

  • It is difficult to assess the risk associated with particular Ajax applications

  • Given full freedom to developers to modify Ajax application makes the testing process challenging

  • Creating automated test request may be difficult for testing tools as such AJAX application often use different encoding or serialization technique to submit POST data.

What is IntelliJ?

Intellij is an IDE that helps you to write better and faster code for Selenium. Intellij can be used in the option to Java bean and Eclipse.

Mention in what ways you can customize TestNG report?

You can customize TestNG report in two ways,

  • Using ITestListener Interface

  • Using IReporter Interface

To generate pdf reports What Java API is required?

To generate pdf reports, you need Java API IText.

What is Listeners in Selenium WebDriver?

In Selenium WebDriver, Listeners “listen” to the event defined in the selenium script and behave accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e. WebDriver Listeners and TestNG Listeners.

What are the types of Listeners in TestNG?

The types of Listeners in TestNG are,

  • IAnnotationTransformer

  • IAnnotationTransformer2

  • IConfigurable

  • IConfigurationListener

  • IExecutionListener

  • IHookable

  • IInvokedMethodListener

  • IInvokedMethodListener2

  • IMethodInterceptor

  • IReporter

  • ISuiteListener

  • ITestListener

What is desired capability? How is it useful in terms of Selenium?

The desired capability is a series of key/value pairs that stores the browser properties like browser name, browser version, the path of the browser driver in the system, etc. to determine the behavior of the browser at run time.

For Selenium,

  • It can be used to configure the driver instance of Selenium WebDriver.

  • When you want to run the test cases on a different browser with different operating systems and versions.

For Database Testing in Selenium Webdriver what API is required?

For Database Testing in Selenium Webdriver, you need JDBC (Java Database Connectivity) API. It allows you to execute SQL statements.

Mention when to use AutoIT?

Selenium is designed to automate web-based applications on different browsers. But to handle window GUI and non-HTML popups in the application you need AutoIT.

Why do you need Session Handling while working with Selenium?

While working with Selenium, you need Session Handling. This is because, during test execution, the Selenium WebDriver has to interact with the browser all the time to execute given commands. At the time of execution, it is also possible that, before current execution completes, someone else starts execution of another script, in the same machine and in the same type of browser. So to avoid such situation you need Session Handling.

What are the advantages of Using Git Hub For Selenium?

The advantages of Using Git Hub for Selenium are

  • Multiple people when they work on the same project they can update project details and inform other team members simultaneously.

  • Jenkins can help you to build the project from the remote repository regularly. This helps you to keep track of failed builds.


Popular posts from this blog

TOP Agile Testing Interview Questions and Answers

Latest Agile Testing Interview Questions and Answers

Most Asked ADO.NET Interview Questions and Answers