Automation

  Home  Testing  Automation


“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

62⟩ Do you know what is Robot API?

Robot API is used to control keyboard or mouse to interact with OS windows like Download pop-up, Alerts, Print Pop-ups, etc. or native Operation System applications like Notepad, Skype, Calculator, etc.

 153 views

63⟩ Explain me what is TestNG and why is it better than JUnit?

TestNG is a testing framework inspired from JUnit and NUnit in a way to use the merits by both the developers and testers. Here are some new functionalities that make it more powerful and easier to use, such as:

☛ test that your code is multithread safe

☛ support for data-driven testing

☛ support for parameters

☛ a variety of tools and plug-ins support (Eclipse, IDEA, Maven, etc...)

☛ default JDK functions for runtime and logging

☛ dependent methods for application server testing

☛ flexible test configuration

 150 views

64⟩ Tell us how can we handle Web-based pop-up?

There are four methods of the effective Web-based pop-up handling:

☛ string getText() method returns the text displayed on the alert box

☛ void accept() method clicks on the “Ok” button as soon as the pop-up window appears

☛ void dismiss() method clicks on the “Cancel” button as soon as the pop-up window appears

☛ void sendKeys(String stringToSend) method enters the specified string pattern into the alert box

 181 views

67⟩ Tell me why to choose Python over Java in Selenium?

Here are some points that favor Python over Java to use with Selenium:

☛ Python is simpler and more compact compared to Java

☛ Java uses traditional braces to start and ends blocks, whilePython uses indentation

☛ Java employs static typing, whilePython is dynamically typed

☛ Java programs tend to run slower compared toPython programs

 181 views

69⟩ Explain me how to Handle Alerts in Selenium WebDriver?

Here are a few methods of Alerts handling which are widely used in Selenium Webdriver.

☛ void dismiss() is used to click on the 'Cancel' button of the alert.

☛ driver.switchTo().alert().dismiss();

☛ void accept() is used to click on the 'OK' button of the alert.

☛ driver.switchTo().alert().accept();

☛ String getText() is used to capture the alert message.

☛ driver.switchTo().alert().getText();

☛ void sendKeys(String stringToSend) is used to send some data to alert box.

☛ driver.switchTo().alert().sendKeys("Text");

 142 views

70⟩ Explain me how to execute JavaScript in Selenium?

JavaScriptExecuter is used for JavaScript execution in Selenium.

A simple example:

WebDriver driver = new FireFoxDriver();

if (driver instanceof JavascriptExecutor) {

((JavascriptExecutor)driver).executeScript("{JavaScript Code}");

}

 142 views

72⟩ Tell me what are the different types of navigation commands?

☛ navigate().back() command takes user back to the previous webpage in the web browser’s history. An example: driver.navigate().back();

☛ navigate().forward() lets the user to navigate to the next web page with reference to the browser’s history. An example: driver.navigate().forward();

☛ According to navigate().refresh() command user can refresh the current web page there by reloading all the web elements. An example: driver.navigate().refresh();

☛ User can launch a new web browser window and navigate to the specified URL by executing navigate().to() An example:

driver.navigate().to(“https:// thinkmobiles.com/”);

 134 views

77⟩ Tell me what kind of mouse actions can be performed in Selenium?

Selenium supports different mouse actions, such as:

☛ click(WebElement element)

☛ contextClick(WebElement element)

☛ doubleClick(WebElement element)

☛ mouseUp(WebElement element)

☛ mouseDown(WebElement element)

☛ mouseMove(WebElement element)

☛ mouseMove(WebElement element, long xOffset, long yOffset)

 152 views

79⟩ Tell us what Selenium components do you know?

Selenium is a suite of tools for automated web testing. It is composed of:

☛ Selenium IDE (Integrated Development Environment). It is a tool for recording and playing back. It is a Firefox plugin.

☛ WebDriver and RC. It provides the APIs for a variety of languages like Java, .NET, PHP, etc. They work with most of the browsers.

☛ Grid: you can distribute tests on multiple machines so that test can be run parallel which helps cutting down the time required for running test suites in the browser.

 177 views

80⟩ Please explain what is the difference between findElement () and findElements ()?

Both of them let user to find elements in the current web page matching to the specified locator value. But if you use findElement(), only the first matching element would be fetched. An example:

WebElement element = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”))

If you use findElements(), the all matching elements would be fetched and stored in the WebElements list. An example:

List elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

 206 views