1. What is the Difference between Manual Testing and Automation Testing?
  • Tests conducted by testers manually is called Manual Testing, wherein they compare the expected and actual functionality are in accordance with the test cases.
  • Tests conducted by using software tool is called Automation Testing, wherein the expected results are fed into the tool to be compared with the actual output of software being tested.
  • Refer link for more Q&A on Automation Testing. (Link to Automation Testing QA)
  1. What are the Popular tools used for automation testing?
  • Selenium
  • HP UFT(Formerly QTP)
  • Rational Robot
  • IBM Rational Functional Tester
  1. Explain the advantages of Automation Testing
  • Reduced test execution time
  • Can be executed in cross platforms test cases (different OS, browsers, environment, etc)
  • Simplifies complex functional tests
  • Automating repetitive tasks
  • Enables parallel execution
  1. What is Selenium Testing?

Selenium is a web browser automation tool, supports numerous scripting language and technologies.

  1. What are the major Selenium components?
  • Selenium IDE
  • Selenium RC
  • Selenium Webdriver
  • Selenium Grid
  1. What are the testing types supported by Selenium?

Selenium supports Functional and Regression Testing

  1. What is Selenium IDE

Selenium IDE is Integrated Development Environment, which is implemented as Firefox extension. It helps us record, edit and debug the tests.

  1. Explain the advantages of Selenium IDE?
  • Easy to Record and Playback
  • Command auto-complete
  • Can set breakpoints while debug mode
  • Assert, Verify and WaitFor options
  1. Language used in Selenium IDE

Language used is Selenese

  1. Does Selenium IDE support multiple test case execution?

Selenium IDE supports suite creation wherein the testcases created under a Suite is executed one by one. Test suite is a simple HTML file listing the tests to be executed in a user-defined format.

  1. Can tests created in Selenium IDE run in different browser?

Selenium IDE created test cases can be executed as suite under Selenium RC using command line interface which invokes Selenium RC Server.
Ex, java -jar selenium-server.jar -htmlSuite “*firefox” “http://www.google.com” “c:\absolute\path\to\my\HTMLSuite.html” “c:\absolute\path\to\my\results.html”

  1. What is the difference between Assert and Verify in Selenium IDE?
  • When an “assert” command fails, the test is aborted.
  • Whereas, when a “verify” command fails, the test will continue execution of next command in test after logging the failure.
  1. What is a Xpath?

Xpath is a XML path language, which describes a way to traverse through XML document to locate nodes. Same is used to locate elements in HTML.

  1. What is the difference between ‘/’ and ‘//’ in Xpath?

‘/’ used to indicate absolute path of an element, majorly when the user knows exact path of an element. Whereas ‘//’ used to indicate relative path of an element, majorly to locate an element from any part of the HTML file.

  1. What is Selenium RC?

Selenium Remote Control (RC) is the first selenium project before Selenium Webdriver. It’s a test tool that allows you to write automated web application user interface tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.

  1. What are the Selenium RC supported languages/client drivers?

Supported languages/client drivers are :

  • Java
  • Ruby
  • Python
  • Perl
  • PHP
  • .Net
  1. Explain the advantages of Selenium
  • Open Source
  • iUser communities for addressing the issues faced
  • Cross browser compatibility
  • Multiple platform compatibility
  • Supports multiple programming/scripting languages
  1. What are the different type of locators used in Selenium

Locators are used to identify elements within a web page, types are listed below :

  • ID
  • Name
  • LinkText
  • PartialLinkText
  • ClassName
  • TagName
  • Xpath
  • CSS Selector
  • DOM
  1. What is Selenium Grid?

Selenium Grid allows us to run tests on different machines against different browsers in parallel. Here different machines can be of different OS and supports distributed test execution.

  1. What is the Difference between Selenium1 and Selenium2?

Selenium1 is Selenium RC and Selenium2 is Selenium Webdriver, major difference is that the Selenium RC communicates to browser via Server, whereas the Webdriver makes direct calls to browser native support for automation.

  1. What are the Browser launch commands used in Webdriver

Following are some major browser related launch commands :
WebDriver driver = new FirefoxDriver(); //Mozilla
WebDriver driver = new ChromeDriver(); //Chrome
WebDriver driver = new InternetExplorerDriver(); //Internet Explorer
WebDriver driver = new RemoteWebDriver(); // Grid
WebDriver driver = new HtmlUnitDriver(); //Headless browser

  1. List down the Webdriver supported drivers

SeleniumHQ drivers :

  • FirefoxDriver
  • InternetExplorerDriver
  • SafariDriver
  • HtmlUnitDriver

Third party drivers :

  • ChromeDriver
  • OperaDriver
  • AndroidDriver
  • IPhoneDriver
  • Etc
  1. Explain in detail different ‘Wait’ operations in Selenium Webdriver

There are two wait types available in Selenium Webdriver – Implicit Wait and Explicit Wait

  • Implicit Wait
  • An implicit wait is to tell Webdriver to provide a default waiting time when trying to find an element or elements if they are not immediately available. The default wait time is 0. For Example,
  • WebDriver driver = new FirefoxDriver();
    manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get(“http://somedomain/url_that_delays_loading”);
    WebElement myDynamicElement = driver.findElement(By.id(“myDynamicElement”));
  • Explicit Wait
  • Used to halt the execution till the time a particular condition is met. Unlike Implicit waits, Explicit waits are applied for a particular instance only. For example,
  • WebDriverWait wait = new WebDriverWait(driver, 10);
    WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id(“someid”)));
  1. What are the differences between findElement() and findElements() ?
  • findElement() : It finds the first element within the current page using the given locating mechanism. It returns a single WebElement.
  • findElements() : Using the given locating mechanism, find all the elements within the current page. It returns a list of web elements.
  1. What is the Command to enter string into textbox using Selenium Webdriver
  • sendKeys(“String”);
  • Example

·WebDriver driver = new FirefoxDriver();
driver.get(“www.google.com”);
WebElement searchName=driver.findElement(By.id(“gs_htif0”));
searchName.sendKeys(“FirstName”);

  1. How to switch between frames in Webdriver?
  • Select frame by Index :

· driver.switchTo().frame(int arg0);

  • Select frame by Name or ID :

· driver.switchTo().frame(String arg0);

  • Select frame by WebElement :

· driver.switchTo().frame(WebElement frameElement);

  1. How handle pop up in web application using Selenium Webdriver?
  • Alert alert = driver.switchTo().alert();
  • To cancel the message :

· alert.dismiss();

  • To accept the message :

· alert.accept();

  • To get string from alert message :

· String msg = alert.getText();

  • To send string to alert box :

· alert.sendKeys(“Hi”);

  1. Can Selenium Webdriver handle windows pop up?
  • No, but a simple program called AutoIT can generate .exe file to be called in webdriver script.
  • Write AutoIT script to upload a file
  • Wait 10 seconds for the Upload window to appear

· WinWait(“[CLASS:#32770]”,””,10)

  • Set input focus to the edit control of Upload window using the handle returned by WinWait

· ControlFocus(“File Upload”,””,”Edit1″)

  • Set the File name text on the Edit field

· ControlSetText(“File Upload”, “”, “Edit1”, “Complete file path”)

  • Click on the Open button

· ControlClick(“File Upload”, “”,”Button1″);

  1. How to call AutoIT script from Selenium Webdriver?
  • getRuntime().exec(“complete AutoIt .exe filepath”);
  1. Write down Selenium script to take screenshot
  • There are multiple ways to achieve the same, one of them is listed below :
  • WebDriver driver = new FirefoxDriver();
    get(“http://www.google.com/”);
    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    // Now you can do whatever you need to do with it, for example copy somewhere
    FileUtils.copyFile(scrFile, new File(“c:\\tmp\\screenshot.png”));
  1. Name the fastest web driver

WebDriver driver = new HtmlUnitDriver(); //Headless browser

  1. What are the Different frameworks available for JAVA Webdriver
  • Junit
  • TestNG
  1. Best Automation Framework type preferred for Webdriver

Hybrid Framework – Its combination of both Data and Keyword Driven Framework

  1. List down the basic browser commands

Get Webpage :

driver.get(“wwww.google.com”);

Get Title :

driver.getTitle();

Get Current URL :

driver.getCurrentUrl();

Get page source :

driver.getPageSource();

Close current window :

driver.close();

Quit the browser :

driver.quit();

  1. What is TestNG?

TestNG is similar to Junit and an open source automated testing framework

  1. What are the advantages of TestNG?
  • Ability to produce HTML reports
  • iAnnotations
  • Grouping and prioritizing made easy
  • Parallel execution of test
  • Parametrization
  1. List annotations in TestNG

@BeforeSuite: The method will be run before all tests in this suite.
@AfterSuite: The method will be run after all tests in suite.
@BeforeTest: The method will be run before any test method belonging to the classes.
@AfterTest: The method will be run after all the test methods belonging to the classes.
@BeforeGroups: The list of groups that this configuration method will run before.
@AfterGroups: The list of groups that this configuration method will run after.
@BeforeClass: The method will be run before the first test method in the current class is invoked.
@AfterClass: The method will be run after all the test methods in the current class have been run.
@BeforeMethod: The method will be run before each test method.
@AfterMethod: The method will be run after each test method.
@Test: The method is a part of a test case.

  1. Whar are the exceptions faced in Webdriver

Some of the exceptions faced are :

  • ElementNotVisibleException,
  • ElementNotSelectableException,
  • NoAlertPresentException,
  • NoSuchAttributeException,
  • NoSuchWindowException,
  • TimeoutException,
  • WebDriverException etc
  1. Explain the ways to handle radio button

For radio button click :

WebElement radioButton = driver.findElement(By.id(“radioID”));

radioButton.click();

To check if the radio button is selected :

List radioButton = driver.findElements(By.name(“radioName”));
boolean rValue = radioButton.get(0).isSelected();

NOTE : rValue will be set to true if selected, else false.

  1. Explain the ways to handle Dropdown list

Selection :

dropDown.selectByVisibleText
dropDown.selectByIndex

Deselect :

dropDown.deselectAll();
dropDown.deselectByIndex(index);
dropDown.deselectByValue(value);
dropDown.deselectByVisibleText(text);

Leave a Reply

Your email address will not be published. Required fields are marked *