By continuing to use our website, you consent to the use of cookies. Please refer our cookie policy for more details.

    Frequently asked questions on the Selenium 2 (Webdriver) Framework

    Q. How to configure the framework in to eclipse?
    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
    Does the framework work only for java language?
    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?
    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?
    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?
    ollowing 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?
    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
    Text boxes, radio buttons, drop downs, check boxes, auto-suggest search drop down, and file upload.
    Q. How can I handle multiple windows?
    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?
    Yes. Example: new WebDriverWait(driver,20).until(ExpectedConditions.presenceOfElementLocated(B"loginBox")))
    Q. Does the framework support the .xlsx extension files for parameterization?
    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?
    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?
    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?
    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?
    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?
    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?
    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?
    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 ?
    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();