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:com.watchrabbit.scanner.attacker.verify.BasicXSSVerificationStrategyIT.java

License:Apache License

@Test
public void shouldFindXss() {
    RemoteWebDriver driver = firefoxFactory.produceDriver();
    try {/*from w w w  . j  a  va  2s.  com*/
        Stopwatch watch = Stopwatch.createStarted(() -> driver.get("http://localhost:8080"));
        Vulnerability vulnerability = new BasicXSSVerificationStrategy().verify(driver,
                watch.getExecutionTime(TimeUnit.MILLISECONDS));

        assertThat(vulnerability).isEqualTo(Vulnerability.EXISTS);
    } finally {
        firefoxFactory.returnWebDriver(driver);
    }
}

From source file:com.watchrabbit.scanner.supervisor.service.FormAnalyzerServiceIT.java

License:Apache License

@Test
public void shouldAnalyzeForm() throws InvalidFormStructureException {
    RemoteWebDriver driver = firefoxFactory.produceDriver();
    try {/*from w  w w  . j  a  v  a  2 s.  c o m*/
        driver.get("https://reg.ebay.pl/reg/FullReg");
        List<WebElement> findElements = driver.findElements(By.xpath("//form"));

        Form prepareStructure = formAnalyzeService.prepareStructure(findElements.get(0));
        formDataGeneratorStrategy.generateFormData(prepareStructure, asList("Test"));

        assertThat(prepareStructure.getFields()).isNotEmpty();
    } finally {
        firefoxFactory.returnWebDriver(driver);
    }

}

From source file:com.watchrabbit.scanner.supervisor.service.FormAnalyzerServiceIT.java

License:Apache License

@Test
public void shouldPerformAttacks() throws InvalidFormStructureException, URISyntaxException {
    RemoteWebDriver driver = firefoxFactory.produceDriver();
    try {//ww  w .  j a  v a 2s.c om
        driver.get("https://ssl.allegro.pl/fnd/registration/");
        List<WebElement> findElements = driver.findElements(By.xpath("//form"));

        Form prepareStructure = formAnalyzeService.prepareStructure(findElements.get(0));
        formDataGeneratorStrategy.generateFormData(prepareStructure, asList("Test"));

        AttackData prepareData = attackGeneratorService.prepareData("adsa1232", prepareStructure);

        AttackResult attackResult = attackerService.performAttack("https://ssl.allegro.pl/fnd/registration/",
                driver, prepareData);

        resultProcessingStrategy.onTestComplete("adsa1232", "https://ssl.allegro.pl/fnd/registration/",
                (attackResult));
        assertThat(prepareStructure.getFields()).isNotEmpty();
        assertThat(attackResult.isFormSent()).isFalse();
    } finally {
        firefoxFactory.returnWebDriver(driver);
    }

}

From source file:com.watchrabbit.scanner.supervisor.service.OrderServiceImpl.java

License:Apache License

private void loadPage(String address, RemoteWebDriver driver) {
    driver.get(address);
    loaderService.waitFor(driver);
}

From source file:de.knowwe.uitest.UITestUtils.java

License:Open Source License

public static RemoteWebDriver setUp(String browser, String testClassName, Platform os, WikiTemplate template,
        String testName, boolean devMode) throws IOException, InterruptedException {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, browser);
    String chromeBinary = System.getProperty("knowwe.chrome.binary");
    if (chromeBinary != null) {
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setBinary(chromeBinary);
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
    }/*from w  ww. j a  v  a 2s.com*/

    RemoteWebDriver driver;
    if (devMode) {
        driver = new RemoteWebDriver(new URL("http://localhost:9515"), capabilities);
    } else {
        capabilities.setCapability("name", testClassName);
        capabilities.setCapability("platform", os);
        driver = new RemoteWebDriver(
                new URL("http://d3web:8c7e5a48-56dd-4cde-baf0-b17f83803044@ondemand.saucelabs.com:80/wd/hub"),
                capabilities);
    }
    driver.manage().window().setSize(new Dimension(1024, 768));
    driver.get(UITestUtils.getKnowWEUrl(template, "Main", devMode));
    if (!UITestUtils.isLoggedIn(driver, template)) {
        UITestUtils.logIn(driver, "UiTest", "fyyWWyVeHzzHfkUMZxUQ?3nDBPbTT6", NORMAL_PAGE, template);
    }
    driver.get(getKnowWEUrl(template, testName, devMode));
    if (!pageExists(template, driver)) {
        createDummyPage(template, driver);
    }
    return driver;
}

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

License:Open Source License

/**
 * <p>browserEngineTest_6.</p>
 *///w w w. j ava2s .  c o m
public static void browserEngineTest_6() {
    RemoteWebDriver wdriver = new FirefoxDriver();

    wdriver.get("http://docs.oracle.com/javase/6/docs/api/");
    try {
        Thread.sleep(10000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    List<FramePath> framepaths = FrameUtils.findFramePaths(wdriver,
            "http://docs.oracle.com/javase/6/docs/api/overview-frame.html");
    if (log.isInfoEnabled()) {
        if (framepaths == null) {
            log.info("Did not find any frame path.");
        } else {
            log.info("Found frame paths.");
        }
    }
}

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

License:Open Source License

/**
 * <p>browserEngineTest_7.</p>
 */// www .j av a 2 s . c  o  m
public static void browserEngineTest_7() {
    RemoteWebDriver wdriver = new FirefoxDriver();
    ProxyClient pc = new ProxyClient("127.0.0.1", 8888);
    BrowserEngine bengine = new BrowserEngine(pc, wdriver);

    wdriver.get("http://docs.oracle.com/javase/6/docs/api/");
    bengine.openUrlInNewWindow("http://www.google.com");
}

From source file:org.asqatasun.websnapshot.service.SnapshotCreatorImpl.java

License:Open Source License

/**
 *
 * @param driver//from w  w  w . jav a2 s. co  m
 * @param url
 */
private String loadPage(RemoteWebDriver driver, String url) {
    try {
        driver.get(url);
        driver.executeScript("if (getComputedStyle(document.body, null).backgroundColor === 'rgba(0, 0, 0, 0)'"
                + "|| getComputedStyle(document.body, null).backgroundColor === 'transparent') {"
                + "document.body.style.backgroundColor = 'white';" + "}");
    } catch (Exception e) {
        Logger.getLogger(this.getClass()).debug("Cannot load this url : " + url);
        return SnapshotCreationResponse.ERROR;
    }
    if (!url.equals(driver.getCurrentUrl())) {
        String urlAvailibility = UrlUtils.checkURLAvailable(driver.getCurrentUrl());
        if (!urlAvailibility.equals(UrlUtils.URL_AVAILABLE)) {
            return urlAvailibility;
        }
    }
    return SnapshotCreationResponse.SUCCESS;
}

From source file:org.jboss.arquillian.graphene.ftest.drone.TestReusingWebDriverSession.java

License:Apache License

private void testReusableSessionId(WebDriver d) {
    RemoteWebDriver rd = (RemoteWebDriver) d;
    if (sessionId == null) {
        sessionId = rd.getSessionId();/*from   w w  w . j  av a  2 s. c o m*/
    } else {
        assertEquals(sessionId, rd.getSessionId());
    }
    rd.get(HUB_URL.toExternalForm());
}

From source file:org.openqa.runner.Commands.java

License:Apache License

public static void open(RemoteWebDriver remoteWebDriver, State state, Map<String, String> params) {
    String url = params.get("url");
    if (checkIsRelativeUrl(url)) {

        String base = state.getBaseUrl().toString();
        if (base.endsWith("/"))
            base = base.substring(0, base.length() - 1);

        url = base.concat(url);/*from   ww  w  .j a va2  s  .c o m*/
    }
    remoteWebDriver.get(url);
}