Example usage for org.openqa.selenium WebDriver quit

List of usage examples for org.openqa.selenium WebDriver quit

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriver quit.

Prototype

void quit();

Source Link

Document

Quits this driver, closing every associated window.

Usage

From source file:de.knowwe.uitest.haddock.PanelHaddockUITest.java

License:Open Source License

public PanelHaddockUITest(String browser, Platform os) throws IOException, InterruptedException {
    super();//from  w  ww  . j a  v a  2s .  co m

    this.browser = browser;
    this.os = os;

    UITestConfig config = new UITestConfig(browser, os);
    if (drivers.get(config) != null) {
        driver = drivers.get(config);
    } else {
        for (WebDriver d : drivers.values()) {
            d.quit();
        }
        driver = UITestUtils.setUp(browser, BMIHaddockUITest.class.getSimpleName(), os, TEMPLATE, getTestName(),
                devMode);
        drivers.put(config, driver);
    }
}

From source file:de.knowwe.uitest.standard.BMIStandardUITest.java

License:Open Source License

public BMIStandardUITest(String browser, Platform os) throws IOException, InterruptedException {
    super();/*w  w  w. j a v a  2 s.c o  m*/

    this.browser = browser;
    this.os = os;

    UITestConfig config = new UITestConfig(browser, os);
    if (drivers.get(config) != null) {
        driver = drivers.get(config);
    } else {
        for (WebDriver d : drivers.values()) {
            d.quit();
        }
        driver = UITestUtils.setUp(browser, BMIHaddockUITest.class.getSimpleName(), os, TEMPLATE, getTestName(),
                devMode);
        drivers.put(config, driver);
    }
}

From source file:de.knowwe.uitest.standard.DiaFluxStandardUITest.java

License:Open Source License

public DiaFluxStandardUITest(String browser, Platform os) throws IOException, InterruptedException {
    super();/*from w  ww .  j  a v a2  s . c  om*/

    this.browser = browser;
    this.os = os;

    UITestConfig config = new UITestConfig(browser, os);
    if (drivers.get(config) != null) {
        driver = drivers.get(config);
    } else {
        for (WebDriver d : drivers.values()) {
            d.quit();
        }
        driver = UITestUtils.setUp(browser, BMIHaddockUITest.class.getSimpleName(), os, TEMPLATE, getTestName(),
                devMode);
        drivers.put(config, driver);
    }
}

From source file:de.knowwe.uitest.standard.FormatterStandardUITest.java

License:Open Source License

public FormatterStandardUITest(String browser, Platform os) throws IOException, InterruptedException {
    super();//from   w  w w  . jav  a 2  s  . com

    this.browser = browser;
    this.os = os;

    UITestConfig config = new UITestConfig(browser, os);
    if (drivers.get(config) != null) {
        driver = drivers.get(config);
    } else {
        for (WebDriver d : drivers.values()) {
            d.quit();
        }
        driver = UITestUtils.setUp(browser, BMIHaddockUITest.class.getSimpleName(), os, TEMPLATE, getTestName(),
                devMode);
        drivers.put(config, driver);
    }
}

From source file:de.knowwe.uitest.standard.PanelStandardUITest.java

License:Open Source License

public PanelStandardUITest(String browser, Platform os) throws IOException, InterruptedException {
    super();/*w ww.ja  v  a2  s  .  co  m*/

    this.browser = browser;
    this.os = os;

    UITestConfig config = new UITestConfig(browser, os);
    if (drivers.get(config) != null) {
        driver = drivers.get(config);
    } else {
        for (WebDriver d : drivers.values()) {
            d.quit();
        }
        driver = UITestUtils.setUp(browser, BMIHaddockUITest.class.getSimpleName(), os, TEMPLATE, getTestName(),
                devMode);
        drivers.put(config, driver);
    }
}

From source file:demo.seleniumtest.Demo.java

public static void main(String[] args) {
    System.setProperty("webdriver.gecko.driver",
            "C:\\Users\\Rumyana\\Desktop\\Testing\\SeleniumDrivers\\geckodriver.exe");
    System.setProperty("webdriver.chrome.driver",
            "C:\\Users\\Rumyana\\Desktop\\Testing\\SeleniumDrivers\\chromedriver.exe");

    // Create a new instance of the Firefox driver
    // Notice that the remainder of the code relies on the interface, 
    // not the implementation.
    //Reset the Table

    WebDriver driver = new ChromeDriver();

    // And now use this to visit Google
    driver.get("http://www.google.com");
    // Alternatively the same thing can be done like this
    // driver.navigate().to("http://www.google.com");

    // Find the text input element by its name
    WebElement element = driver.findElement(By.name("q"));

    // Enter something to search for
    element.sendKeys("Cheese!");

    // Now submit the form. WebDriver will find the form for us from the element
    element.submit();/*w w w. j  a v a  2s  .  c  o  m*/

    // Check the title of the page
    System.out.println("Page title is: " + driver.getTitle());

    // Google's search is rendered dynamically with JavaScript.
    // Wait for the page to load, timeout after 10 seconds
    (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver d) {
            return d.getTitle().toLowerCase().startsWith("cheese!");
        }
    });

    // Should see: "cheese! - Google Search"
    System.out.println("Page title is: " + driver.getTitle());

    //Close the browser
    driver.quit();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_10.</p>
 *///from  w  w w. j  a v a 2  s .  c  o m
public static void browserEngineTest_10() {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(null, profile);

    wdriver.get("http://www.dkfjaojfko.com");
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    System.out.println(wdriver.getCurrentUrl());
    System.out.println(wdriver.getTitle());
    System.out.println(wdriver.getPageSource());
    wdriver.quit();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_19.</p>
 *
 * @throws edu.uga.cs.clickminer.exception.ProxyErrorException if any.
 * @throws java.lang.InterruptedException if any.
 *//*  www  .j a va  2  s  .c o m*/
public static void browserEngineTest_19() throws ProxyErrorException, InterruptedException {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-17.0/firefox-bin")), profile,
            TestUtils.createProxyConfig());

    for (int i = 0; i < 10; i++) {
        //wdriver.get("http://choices.truste.com/get?name=admarker-full-tr.png");
        wdriver.get("http://blah.blah.com");
        Thread.sleep(5000);
    }

    wdriver.quit();
}

From source file:edu.uga.cs.clickminer.test.WindowStateTest.java

License:Open Source License

/**
 * <p>windowStateTest_2.</p>
 *
 * @throws java.lang.Exception if any.//from  ww  w  . jav  a2 s.  c o m
 */
public static void windowStateTest_2() throws Exception {
    long poll_interval = 10000;
    WebDriver wdriver = new FirefoxDriver(TestUtils.createProxyConfig());
    ProxyClient pclient = new ProxyClient("127.0.0.1", 8888);
    wdriver.get("http://www.google.com");

    WindowState bstate = new WindowState(pclient, wdriver, wdriver.getWindowHandle());
    Thread.sleep(2000); // not the best way to do this, but quick and dirty

    while (!bstate.isResting()) {
        try {
            System.out.println(bstate);
            Thread.sleep(poll_interval);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    System.out.println("The browser is in a resting state.");
    System.out.println(bstate);
    bstate.reset();
    wdriver.quit();
}

From source file:edu.usc.cs.ir.htmlunit.handler.HtmlUnitWebDriver.java

License:Apache License

public static void cleanUpDriver(WebDriver driver) {
    if (driver != null) {
        try {/*from  w  w w.  j a  v  a 2s  .c om*/
            driver.close();
            driver.quit();
            TemporaryFilesystem.getDefaultTmpFS().deleteTemporaryFiles();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}