+91 (172) 5048500

Frequently asked questions on the Selenium 2 (Webdriver) Framework

Q. How to configure the framework in to eclipse?

  1. Following are the steps to configure framework in eclipse:
    • Extract the provided zip folder
    • Open eclipse and create a new project using the extracted zip folder
    • Run the sample test script by using the JUnit option
    • Create new test scripts in the folder 'TestScipts' and run them using JUnit option

Q. Does the framework work only for java language?

  1. The framework is made in Java language but is language agnostic and can be used with any language.

Q. What is meant by Page Object Model design?

  1. Page Object Model is a simple design pattern that models each page (or page chunk) as a class object that other classes / objects can interact with.

Q. Where can I see the generated reports?

  1. We can see the HTML view of generated reports:
    • Run the build.xml as Ant Build
    • Refresh the project and open the Reports folder
    • From the Reports folder, open the index.html file with Web Browser

Q. How can I change the browser to be used for running the test scripts?

  1. Following are the steps:
    • Go to the config folder
    • Open the “” file
    • Uncomment the needed browser configuration and comment the not needed browser in this file and save the file

Q. Does WebDriver support file uploads?

  1. Yes, it is possible if you call WebElement#sendKeys("/path/to/file") on a file upload element. Make sure you don't use WebElement#click() on the file upload element or the browser will hang.

Q. What input fields have been targeted in v3 of the framework using parameterization

  1. Text boxes, radio buttons, drop downs, check boxes, auto-suggest search drop down, and file upload.

Q. How can I handle multiple windows?

  1. You can handle multiple windows using the "WebDriver.switchTo().window()" method - here window name is required. If the name is not known, you can use "WebDriver.getWindowHandles()" to obtain a list of known windows and then switch to a specific window.

Q. Can I make webdriver to wait for some event on default?

  1. Yes.
    • Example: new WebDriverWait(driver,20).until(ExpectedConditions.presenceOfElementLocated(B"loginBox")))

Q. Does the framework support the .xlsx extension files for parameterization?

  1. Yes. We have provided support for .xlsx extension files i.e. 2007-2010 format, using Apache POI.

Q. When I can use implicit and explicit wait?

  1. Implicit wait will be used when you need to wait for all elements in script, while Explicit wait method will be used only for particular specified elements. Explicit wait will be preferred for dynamically loading ajax elements.
    • Implicit Wait Example:
    • driver.manager().timeouts.implicityWait(10,TimeUnit.SECONDS);
    • Explicit Wait Example:
    • public static WebElement explicitWait(WebDriver driver,By by){
    • WebDriverWait wait = new WebDriverWait(driver,30);
    • wait.until(ExpectedConditions.presenceOfElementLocated(by));}

Q. Which command should be used to quit WebDriver instance?

  1. The quit() method is used to quit WebDriver instance. That is: driver.quit();

Q. How can I drag element from one position and drop to second position?

  1. This event can be implemented by using Action interface. Example:
    • Actions builder = new Actions(driver);
    • Action dragAndDrop = builder.clickAndHold(someElement).
    • moveToElement(otherElement).release(otherElement).build();
    • dragAndDrop.perform();

Q. How can I move backwards or forwards in browser's history in Webdriver?

  1. You can move backwards and forwards in browser’s history as below:
    • //To go backward
    • driver.navigate().back();
    • //To go forward
    • driver.navigate().forward();

Q. How can I get title of the window?

  1. You can get the title of the window by using getTitle() method:
    • String title = driver.getTitle();
    • System.out.println("Title of the page is "+title);

Q. How to Maximize the browser to screen size?

  1. To maximize the browser window to screen size Toolkit.getScreenSize() method is used:
    • Toolkit toolkit = Toolkit.getDefaultToolkit();
    • Dimension screenResolution = new Dimension((int)
    • toolkit.getScreenSize().getWidth(), (int)
    • toolkit.getScreenSize().getHeight());
    • driver.manage().window().setSize(screenResolution);

Q. How to handle pageload time in webdriver?

  1. You can set the PageLoadTimeout value to whatever you need using:
    • driver.Timeouts.PageLoadTimeout(XX, SECONDS)
    • where XX is the number of seconds you want the timeout to be set to.
    • Uncomment the needed browser configuration and comment the not needed browser in this file and save the file

Q. How can i get text from alert window ?

  1. To get text from alert box, first you have to switch on alert, and then you can use getText method:
    • Alert alert = driver.switchTo().alert();
    • // Get the text from the alert
    • String alertText = alert.getText();

Get In Touch