Basic Automation Interview Preparation Guide
Download PDF

Automation related Frequently Asked Questions by expert members with professional career as Automation. These list of interview questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts

108 Automation Questions and Answers:

Table of Contents:

Basic  Automation Job Interview Questions and Answers
Basic Automation Job Interview Questions and Answers

1 :: Do you know the difference between close and quit command?

If you need to close the current browser having focus driver.close() is used. If you need to close all the browser instances driver.quit() is used.

2 :: Do you know what is a data-driven framework?

The Data Driven test design framework follows a design paradigm where test logic is fixed but varies the test data. The data itself can be in different repositories like a simple .csv file, .json file or .xls sheet, or database and can add the tests merely updating those external files or DB (instead of placing in test code itself).

3 :: Tell me the fundamental difference between XPath and CSS selector?

Using CSS selector we can only move downwards in the document, using XPaths we traverse up in the document.

4 :: Tell us how can you create HTML test report from your test script?

There are three ways of HTML test report creation:

☛ using inbuilt default.html to get the HTML report in TestNG
☛ with the ANT help in JUnit
☛ using XSL jar for converting XML content to HTML in own customized reports

5 :: Tell us how can you run Selenium Server other than the default port 4444?

Selenium server could be run on java-jar selenium-server.jar-port other than its default port.

6 :: Tell us what is JUnit? And what is JUnit Annotation?

JUnit is an open source Java applications testing framework, introduced by Apache. A process of adding a special form of syntactic metadata to Java source code is called annotation. JUnit Annotations are: variables, parameters, packages, methods and classes.

7 :: Explain me what could be the cause of Selenium WebDriver test to fail?

There are some causes of Selenium WebDriver test to fail:

☛ SeleniumWebDriver element waiting to access did not appear on the web page and the operation timed out
☛ SeleniumWebDriver is trying to access not created element
☛ SeleniumWebDriver cannot locate the element, because the locator has been changed

8 :: Do you know what is a XPath?

XPath is a language that describes a way to locate and process items in Extensible Markup Language (XML) documents by using an addressing syntax based on a path through the document's logical structure or hierarchy.

9 :: Tell me do you know a way to refresh browser by using Selenium?

The list of commands to refresh a page in Selenium:

☛ navigate().refresh()
☛ getCurrentUrl()
☛ navigate().to(driver.getCurrentUrl())
☛ sendKeys(Keys.F5)

10 :: Tell us how will you use Selenium to upload a file?

File uploading action could be performed by using element.sendKeys("path of file") on the webElement of input tag and type file: < name="fileUpload" type="file" />
As all links are of anchor tag 'a', so we can find all of them on a web page by locating elements of tagName ‘a’:

List links = driver.findElements(By.tagName("a"));

12 :: Tell me how colors could be handled in Selenium WebDriver?

To handle colors could be handled in Selenium WebDriver by using Use getCssValue(arg0) function to get the colors by sending ‘color’ string as an argument.

13 :: Tell us the difference between assert and verify commands?

Both of them check if the given condition is true or false. Unlike to "assert", "verify" will not stop the test case execution if the test case fail.

14 :: Tell me how can we launch different browsers in Selenium WebDriver?

We should create an instance of a driver of a particular browser:

WebDriver driver = new FirefoxDriver();

15 :: Tell us how could you explain the main difference between WebDriver and RC?

Selenium WebDriver drives the browser using built-in support. RC injects JavaScript function into browsers when the page is loaded.

16 :: Explain me which web driver implementation is the fastest?

The fastest WebDriver is HtmlUnitDriver. Differing of other drivers (FireFoxDriver, ChromeDriver etc), it’s non-GUI, while running no browser gets launched.

17 :: Tell me how do perform drag and drop using Selenium WebDriver?

The next Actions class is used to perform drag and drop:

Actions builder = new Actions(driver);
Action dragAndDrop = builder.clickAndHold(SourceElement)
moveToElement(TargetElement)
release(TargetElement)
build();
dragAndDrop.perform();

18 :: Tell me how can the user get a text of a web element?

User can retrieve the text of the specified web element by using get command. It doesn’t require any parameter but returns a string value.

String Text = driver.findElement(By.id(“Some Text”)).getText()
is an example of it.

19 :: Tell me the meaning of assertion in Selenium and what are the types of assertion?

Assertion is used as a verification point. It verifies that the application state conforms to the expectation. The types of assertion are “assert”, “verify” and “waifFor”.

20 :: Tell me how could AJAX controls be handled in WebDriver?

AJAX allows the Web page to retrieve small amounts of data from the server without reloading the entire page.

The different wait methods should be applied for testing Ajax application:

☛ ThreadSleep
☛ Implicit Wait
☛ Explicit Wait
☛ WebdriverWait
☛ Fluent Wait

21 :: Tell me what is a keyword-driven framework?

The keyword driven framework is a methodology where actions or steps are treated as keywords. These keywords (like click, move, type etc.,) are stored in some external repositories along just like data (in .csv/.json/.xls/DB).

22 :: Explain me how to check if an element is visible on the page?

The return method type is logical. If it returns true then element is visible otherwise it is not. isDisplayed() method could be used for it:

driver.findElement(By.id(“id_of_element”)).isDisplayed();

23 :: Do you know how to verify if the checkbox/radio is checked or not?

isSelected() method is used to verify if the checkbox/radio is checked or not. An example -

driver.findElement(By.xpath("XPath of the checkbox/radio button")).isSelected();

24 :: Do you know how to mouse hover an element in Selenium?

Code to mouse hover over an element in Selenium:

Actions action = new Actions(driver);
WebElement element=driver.findElement(By.id("elementId"));
action.moveToElement(element).perform();

25 :: Tell us how do you get the width of the textbox?

You can get the width of the textbox by using the following command:

driver.findElement(By.xpath(“xpath of textbox ”)).getSize().getWidth();
driver.findElement(By.xpath(“xpath of textbox ”)).getSize().getHeight()
Automation Interview Questions and Answers
108 Automation Interview Questions and Answers