dridhOn

Selenium Interview Question and Answers

Selenium Interview Question and Answers

1) What is an Object Repository, and how does it work?

An object repository is a critical component of any UI automation since it allows a tester to keep all of the objects that will be utilised in the scripts in one or more centralised locations rather than scattering them throughout the test scripts.

 

2) What is the Selenium Grid and how does it work?

The tests were delivered to the hub by Selenium Grid. These tests are routed through Selenium Webdriver, which opens the browser and runs the test. It is possible to run tests in parallel using the whole test suite.

 

3) Is Selenium grid suitable for performance testing?

Yes. However, it does not perform as well as a specialised Performance Testing tool such as Loadrunner.

 

4) What are the benefits of using Webdriver instead of Selenium Server?

You don't require the Selenium-WebDriver plugin if you're using Selenium-WebDriver.

Selenium Server is unique in that it use a completely separate technology.

Selenium Server has Selenium RC capabilities, which is needed for backwards compatibility with Selenium 1.0.

Selenium Web driver provides direct calls to browsers, taking advantage of each browser's inherent automation functionality, whereas Selenium RC relies on the selenium server injecting Javascript into the browser.

 

5) What capabilities does Selenium WebDriver or Selenium 2.0 have?

When you need better support for something, WebDriver is the way to go.

Multiple frames, pop-ups, browser windows, and notifications to manage
Page navigation and Ajax-based UI elements that can be dragged and dropped
Multi-browser testing, including better capability for Selenium 1.0 browsers that aren't well supported

 

6) What are the limitations that can be encountered while inserting capabilities in webdriver to execute tests on a browser that is not supported by a webdriver?

The "findElement" command may not perform as expected, which is a major limitation of injecting capabilities.

 

7) How can you use the Selenium Web driver to discover damaged images on a page?

The Selenium web driver can be used to find broken images on a page.

Get XPath and use tag name to get all the links on the page.
Click on each and every link on the page.

 

8) Look for the words 404/500 in the title of the destination page. How do you handle colours in a web driver?

You can use the web driver to handle colours.

By passing the 'colour' string as an argument to the getCssValue(arg0) method, you can get the colours.

 

9) How do you store a value in a text box using a web driver?

You can use the web driver to store a value in a text box by using the following command.

findElement(By.id("your Textbox")); driver.findElement(By.id("your Textbox")); driver.findElement(By.

sendKeys("your keyword"); sendKeys("your keyword"); sendKeys("your keyword

 

10) Can you explain how you can change frames?

The [driver.switchTo().frame()] method in webdrivers takes one of three arguments to switch between frames.

 

a figure: It chooses the number based on

according to its (zero-based) index

A name or identification number: Choose a frame based on its name or ID.

Previously discovered WebElement: Select a frame using the previously discovered WebElement.

 

11) Describe five different Selenium web driver exceptions.

You had five separate exceptions with Selenium web drivers.

WebDriverException
NoAlertPresentException
NoSuchWindowException
NoSuchElementException
TimeoutException

 

12) Explain how to perform a double click using Webdriver.

Using the mouse, you can do a double click.

Act = new Actions (driver); act.doubleClick(webelement);

 

13) Syntax- Actions act = new Actions (driver); act.doubleClick(webelement); How will you upload a file with Selenium?

You can enter in a file input box of an upload file using the "type" command. Then, to make file upload work, you must use JAVA's "Robot" class.

 

14) Which implementation of a web driver is the quickest?

HTMLUnitDriver's implementation is the quickest; HTMLUnitDriver does not run tests in the browser but instead sends a plain http request, which is far faster than opening a browser and running tests.

 

15) Can you explain how you can use Selenium 2.0 to manage frames?

You can use the "SwitchTo" frame technique to get control over an HTML frame.

driver.switchTo().frame(“frameName”);

To specify a frame you can use index number

driver.switchTo().frame(“parentFrame.4.frameName”);

This would bring control on frame named- “frameName” of the 4th sub frame names “parentFrame”

 

16) What is the difference between getWindowhandles() and getwindowhandle() ?

getwindowhandles(): It is used to get the address of all the open browser and its return type is Set<String>

getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string

 

17) Explain how you can switch back from a frame?

To switch back from a frame use method defaultContent()

Syntax-driver.switchTo().defaultContent(); 

 

18) What are the many sorts of locators?

There are various sorts of locators.

By.id()

By.name()

By.tagName()

By.className()

By.linkText()

By.partialLinkText()

By.xpath

By.cssSelector()

 

19) In order to display the values of a variable in the output console or log, what command is used?

echo is a command that can be used to display a constant string.

You can use commands like echo $variable name>> to display the value of a variable.

PHP is used in the example above. Replace echo with System.out if you're using Java. println

 

20) Can you explain how you can use Selenium's recovery scenario?

The type of recovery scenario you utilise is determined on the programming language you use. If you're using Java, you can use exception handling to get around the problem. Using the "Try Catch Block" option within Java testing using Selenium WebDriver

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.