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.comcast.dawg.house.AdvanceFilterUIIT.java

License:Apache License

private AdvanceFilterNavigator launchAdvancedFilter() {
    RemoteWebDriver driver = drivers.get();
    driver.get(TestServers.getHouse() + TOKEN + "?q=return_nothing_query");
    driver.findElementByClassName(IndexPage.ADV_SEARCH_BUTTON).click();

    return new AdvanceFilterNavigator(driver);
}

From source file:com.comcast.dawg.house.EditDeviceUIIT.java

License:Apache License

private EditDeviceOverlay loadPageAndLaunchEditOverlay(RemoteWebDriver driver, String token, String deviceId) {
    driver.get(TestServers.getHouse() + token + "?q=" + deviceId);
    return launchEditOverlay(driver, deviceId);
}

From source file:com.comcast.dawg.house.LoginPageIT.java

License:Apache License

/**
 * @author Kevin Pearson//from   w  w w . j av  a  2  s .c o  m
 * @throws IOException
 */
@Test(description = "Tests if a user can input a user name and click enter to log in", groups = "uitest")
public void testLogin() throws IOException {
    String user = "integrationuser";

    RemoteWebDriver driver = drivers.get();
    driver.get(TestServers.getHouse());
    loginWithUserName(driver, user);
    String expectedNewPageUrl = TestServers.getHouse() + user + "/";
    Assert.assertEquals(driver.getCurrentUrl(), expectedNewPageUrl);
    WebElement userInfo = driver.findElementByClassName(IndexPage.USER_SECTION_CLASS);
    List<WebElement> spans = userInfo.findElements(By.tagName(Tag.SPAN.toString()));
    Assert.assertFalse(spans.isEmpty());
    WebElement userDisplaySpan = spans.get(0); // the first span should show the user name
    Assert.assertEquals(userDisplaySpan.getText(), user);
}

From source file:com.comcast.dawg.house.LoginPageIT.java

License:Apache License

/**
 * @author Kevin Pearson/*from  w  ww. j a  va2s  .c o m*/
 * @throws IOException
 */
@Test(description = "Tests if a message explaining that a username was invalid "
        + "becomes visible when the user tries to log in with an invalid username", groups = "uitest")
public void testBadLogin() throws IOException {
    RemoteWebDriver driver = drivers.get();
    String user = "$$$$";

    driver.get(TestServers.getHouse());
    WebElement badLoginMessage = driver.findElementById(LoginPage.BAD_USER_MSG_ID);
    Assert.assertEquals(badLoginMessage.getCssValue("display"), "none");
    loginWithUserName(driver, user);

    String expectedNewPageUrl = TestServers.getHouse();
    Assert.assertEquals(driver.getCurrentUrl(), expectedNewPageUrl);
    badLoginMessage = driver.findElementById(LoginPage.BAD_USER_MSG_ID);
    Assert.assertEquals(badLoginMessage.getCssValue("display"), "block");
}

From source file:com.digitalpebble.stormcrawler.protocol.selenium.SeleniumProtocol.java

License:Apache License

public ProtocolResponse getProtocolOutput(String url, Metadata metadata) throws Exception {
    // TODO check that the driver is not null
    RemoteWebDriver driver = getDriver();
    try {//from  ww w  .  j a v a 2 s. com
        // This will block for the page load and any
        // associated AJAX requests
        driver.get(url);

        // call the filters
        ProtocolResponse response = filters.filter(driver, metadata);
        if (response == null) {
            // if no filters got triggered
            byte[] content = driver.getPageSource().getBytes();
            response = new ProtocolResponse(content, 200, metadata);
        }
        return response;
    } finally {
        // finished with this driver - return it to the queue
        drivers.put(driver);
    }
}

From source file:com.mycompany.myproject.sample.simple.DemoMobileTest.java

License:Apache License

@Test(enabled = false)
@MobileTest(appName = "browser", device = "android:4.4.4", deviceType = "Android Emulator")
public void selionDemoAppiumAndroid() {
    RemoteWebDriver driver = Grid.driver();
    driver.get("http://selion.io");

    // take screenshot, capture source code, put in report
    SeLionReporter.log("landed", false, false);
}

From source file:com.mycompany.myproject.sample.simple.DemoMobileTest.java

License:Apache License

@Test
@MobileTest(appName = "safari", device = "iphone:8.1", deviceType = "iPhone Simulator")
public void selionDemoAppiumIOS() {
    RemoteWebDriver driver = Grid.driver();
    driver.get("http://selion.io");

    // take screenshot, capture source code, put in report
    SeLionReporter.log("landed", true, true);
}

From source file:com.mycompany.myproject.sample.simple.DemoWebTest.java

License:Apache License

@Test
public void seleniumDemo() throws Exception {
    // Hard coded to firefox
    DesiredCapabilities caps = DesiredCapabilities.firefox();
    // Hard coded selenium host
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://192.168.99.100:4444/wd/hub"), caps);
    driver.get("http://google.com");

    String source = driver.getPageSource();
    File file = driver.getScreenshotAs(OutputType.FILE);

    //TODO log the screenshot and source to a report

    // don't forget to close the WebDriver connection
    driver.quit();//from w w  w  .  j  a  v  a2  s  . co  m
}

From source file:com.mycompany.myproject.sample.simple.DemoWebTest.java

License:Apache License

@Test(threadPoolSize = 50, invocationCount = 50)
@WebTest/*from ww w . jav a2 s  .c  o  m*/
public void selionDemo() {
    // browser determined by config or supplied @ runtime
    RemoteWebDriver driver = Grid.driver();
    driver.get("http://google.com");

    // take screenshot, capture source code, put in report
    SeLionReporter.log("landed", true, true);
}

From source file:com.mycompany.myselion.sample.selion.AppiumAndroidDemoTest.java

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against ANDROID browser using appium.
 * <ul>//  w ww  .java  2  s .c om
 * <li>
 * An appium instance/server should be installed and running where selenium host and port should be 
 * pointed to this instance.</li>
 * <li>
 * For setting up Appium Android refer http://appium.io/slate/en/master/?ruby#system-setup-(android)
 * </li>
 * </ul> 
 */
@Test
@MobileTest(appName = "Browser", device = "android:5.0.1", deviceType = "Android Emulator")
public void testWithBrowser() {
    RemoteWebDriver driver = Grid.driver();
    assertNotNull(driver);
    // And now use this to visit Google
    driver.get("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();
    SeLionReporter.log("cheese!", true);
}