Example usage for org.openqa.selenium.remote RemoteWebDriver get

List of usage examples for org.openqa.selenium.remote RemoteWebDriver get

Introduction

In this page you can find the example usage for org.openqa.selenium.remote RemoteWebDriver get.

Prototype

@Override
    public void get(String url) 

Source Link

Usage

From source file:org.tanaguru.rules.generator.json.TanaguruJsTestCaseExtractor.java

License:Open Source License

/**
 * @param args the command line arguments
 * @throws java.net.MalformedURLException
 *//*from www  .  ja  v  a2s . c  o m*/
public static void main(String[] args) throws MalformedURLException, IOException, InterruptedException {
    //        DesiredCapabilities caps = new DesiredCapabilities();
    //        caps.setJavascriptEnabled(true);
    //        WebDriver driver = new PhantomJSDriver(caps);
    //        FirefoxDriver driver = 
    //                new FirefoxDriver(
    //                        new FirefoxBinary(new File(PATH_TO_FF)), 
    //                        new FirefoxProfile());

    DesiredCapabilities ff = DesiredCapabilities.firefox();
    //        DesiredCapabilities chrome = DesiredCapabilities.chrome();
    RemoteWebDriver driver = null;
    try {
        driver = new RemoteWebDriver(new URL(HUB_URL), ff);
        //            driver = new RemoteWebDriver(new URL("http://172.17.0.23:4444/wd/hub"), chrome);
        String script = IOUtils.toString(
                TanaguruJsTestCaseExtractor.class.getClassLoader().getResourceAsStream(JS_SCRIPT_NAME));

        for (Element el : Jsoup.parse(new URL(URL_LIST), 5000).select("a")) {
            String url = el.attr("abs:href");
            String resourceName = StringUtils.remove(el.attr("href"), ".html");
            if (StringUtils.contains(url, "html")) {
                driver.get(url);
                driver.findElementByTagName("body").sendKeys(Keys.TAB);
                try {
                    FileUtils.write(new File(PATH_TO_WRITE + resourceName + ".json"),
                            new JSONArray(driver.executeScript(script).toString()).toString(4));
                } catch (JSONException ex) {
                }
            }
        }
    } finally {
        if (driver != null) {
            driver.quit();
        }
    }
}

From source file:org.uiautomation.ios.selenium.Demo.java

License:Apache License

public static void main3(String[] args) throws Exception {

    DesiredCapabilities safari = IOSCapabilities.ipad("Safari");
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), safari);

    driver.get("http://ebay.co.uk");

    ((Rotatable) new Augmenter().augment(driver)).rotate(ScreenOrientation.LANDSCAPE);

    WebElement search = driver.findElement(By.id("srchDv"));
    search.sendKeys("ipod");
    search.submit();/*from   w w w.  j  a v a 2 s . c  o m*/

    waitFor(pageTitleToBe(driver, "ipod | eBay Mobile Web"));

    driver.quit();
}

From source file:org.uiautomation.ios.selenium.Demo.java

License:Apache License

public static void main2(String[] args) throws Exception {

    DesiredCapabilities safari = IOSCapabilities.iphone("Safari");
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), safari);

    driver.get("http://hp.mobileweb.ebay.co.uk/home");
    WebElement search = driver.findElement(By.id("srchDv"));
    search.sendKeys("ipod");
    search.submit();/* w w w. ja  v  a 2 s  . c om*/

    waitFor(pageTitleToBe(driver, "ipod | eBay Mobile Web"));

    driver.quit();
}