Top Automation Testing Interview Questions-Answers in 2020

TechiesHub9
4 min readNov 2, 2020
Automation Testing

Q. 1. What is Automation Testing?

Answer — Automation Testing or Test Automation is a process of automating the manual process to test the application/system under test.

Automation Testing involves use of a separate testing tool which lets you create test scripts that can be executed repeatedly and doesn’t require any manual intervention.

Advantages:

1. Useful to execute routine tasks like Smoke tests and Regression tests.

2. Useful in preparing Test Data.

3. Helps to execute the Test cases which involve complex business logic.

4. Good to execute the cross-platform test cases(like different OS, browsers,etc.)

5. Great to execute the test cases which are a bit difficult to execute manually.

6. When the no. of iterations of the test case executions is not known. etc.

Q.2. Difference between get() and navigate().to() methods?

Answer — Both methods exactly do the same thing.

get() — It loads a new web page and does not maintain the browser’s history.

navigate().to() — It Loads a new web page and maintains the browser’s history.It can move backwards and forwards in your browser’s history.

Q.3. Difference between quit() and close() method?

Answer — quit() — It Stops/Quits the driver instance and close all open browser window. It closes the browser window and the driver closes after executing a Test Script.
For real understanding, you can check it in Task Manager’s Detail tab to see how close() and quit() operate in the background.chromedriver.exe or any driver exe file get’s disappear from task manager if you use quit() method.
Close() — It closes the current active window if there are multiple windows. The browser quits if only one window is active. It Closes the browser window but the driver remains open after executing a Test Script.
chromedriver.exe or any driver exe file still appears in task manager if you use close() method.

Q.4. With what plugin you can execute all your test cases in Maven project?

Answer — Using maven-surefire-plugin you can execute all your test cases in Maven project.

Q.5. What are the testing types that can be supported by Selenium?

Answer — Selenium supports the following types of Testing:

1. Functional Testing
2. Regression Testing

Q.6. What are the different types of Locators in Selenium WebDriver?

Answer — Locators can be termed as an address that identifies a web element uniquely within the web page. To identify web elements accurately and precisely we have different types of locators in Selenium:

1. Id

2. ClassName

3.Name

4.TagName

5. LinkText

6. PartialLinkText

7.Xpath

8.CSS Selector

9. DOM

Q.7. What is Xpath?

Answer — Xpath is used to locate a web element based on it’s XML Path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data.

It stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, Xpath can be used to locate HTML elements.

The fundamental behind locating elements using Xpath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.

Q.8. What is difference between Relative Xpath(‘//’) and Absolute Xpath(‘/’)?

Answer Relative Xpath(“//”) — “//” is used to create Xpath with relative path i.e. the Xpath would be created to start selection from anywhere within the document.

Absolute Xpath(/) — “/” is used to create Xpath with absolute path i.e. the XPath would be created to start selection from the document node/start/root node.

Q.9. What is difference between assert and verify commands?

Answer — Assert — Assert command checks whether the given condition is true or false. Let’s say we assert whether the given element is present on the web page or not. If the condition is true then the program control will execute the next test step but if the condition is false, the execution would stop and no further test would be executed.

Verify: Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halts i.e. any failure during verification would not stop the execution and all the test steps would be executed.

Q.10. How to type in a textbox using Selenium?

Answer — 1. sendKeys() method:

User can use sendKeys(“String to be entered”) method to enter the string in the textbox.

Syntax: WebElement password = driver.findElement(By.id(“pwd”));

password.sendKeys(“abc”);

2. JavaScript Executor:

User can use Javascript Executor Interface to enter text in textbox. It uses it’s executeScript() method to enter text in textbox.

Syntax: JavascriptExecutor jse = (JavascriptExecutor)driver;

jse.executeScript(Script, Arguments);

Ex. JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript(“document.findElementByXpath(‘…’).value=’…’”);

For more Questions click here.

--

--