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

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

Introduction

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

Prototype

@Override
    public WebElement findElement(By by) 

Source Link

Usage

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static String getLicenseCostInfo(RemoteWebDriver driver) throws IOException {
    return driver.findElement(By.cssSelector(applangoTextfields.MAIN_LICENSE_COST.getValue())).getText();
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static String getLicenseCostInAccountPage(RemoteWebDriver driver, WebDriverWait wait)
        throws IOException {
    //        genericApplangoWebsiteActions.openUserAccount(driver, wait);
    //            Click on SF in account page
    driver.findElement(By.xpath("//*[@id=\"applist\"]/div[3]")).click();
    waitUntilWaitForServerDissappears(wait);
    return driver.findElement(By.id("licenses")).getText();
}

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

License:Apache License

@Test
@MobileTest(appPath = TEST_APP_PATH, device = "android:19")
public void testNative() {
    RemoteWebDriver driver = Grid.driver();
    WebDriverWaitUtils.waitUntilElementIsVisible("io.selendroid.testapp:id/my_text_field");
    SeLionReporter.log("Main page", true, true);
    WebElement textField = driver.findElement(By.id("io.selendroid.testapp:id/my_text_field"));
    assertEquals("true", textField.getAttribute("enabled"));
    textField.sendKeys("Appium Android Native Test");
    SeLionReporter.log("Entered text", true, true);
    assertEquals("Appium Android Native Test", textField.getText());
}

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

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against a Native ANDROID app using appium.
 * <ul>//from   ww w. ja  va 2 s  . co m
 * <li>
 * An appium instance/server should be locally installed and running and point SeLion to this server using any of the following options. 
 * <ol>
 * <li>Through the JVM arguments -DSELION_SELENIUM_HOST and -DSELION_SELENIUM_PORT </li> (or)
 * <li>Through suite file &lt;parameter name="seleniumhost" value=""/&gt; and &lt;parameter name="seleniumport" value=""/&gt;</li>
 * </ol></li>
 * <li>
 * For setting up Appium Android refer http://appium.io/slate/en/master/?ruby#system-setup-(android)
 * </li>
 * </ul>
 */
@Test
@MobileTest(appPath = "src/test/resources/apps/selendroid-test-app-0.15.0.apk", device = "android:5.0.1", deviceType = "Android Emulator")
public void testWithNativeApp() {
    RemoteWebDriver driver = Grid.driver();
    WebDriverWaitUtils.waitUntilElementIsVisible("io.selendroid.testapp:id/my_text_field");
    WebElement textField = driver.findElement(By.id("io.selendroid.testapp:id/my_text_field"));
    assertEquals("true", textField.getAttribute("enabled"));
    textField.sendKeys("Appium Android Native Test");
    assertEquals("Appium Android Native Test", textField.getText());
}

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>/*from   w  w  w.j  a  v a2 s.  co m*/
 * <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);
}

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

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against a Native ANDROID app using appium 
 * and apps placed in selion hub storage. 
 * <ul>/* w  w  w  . j a va 2s .com*/
 * <li>
 * An instance of selion grid should be spawned and the appium instance should be registered to this grid.</li>
 * <li>
 * The app selendroid-test-app-0.14.0.apk to be tested should be uploaded to SeLion hub storage 
 * provided by SeLion grid.</li>
 * <li>
 * The format of the appPath for the apps in the SeLion hub storage is as follows 
 * selion-hub-storage:{user-guid}:{folderName}:{file} where user-guid is a random unique guid and it is mandatory 
 * while uploading a file. foldername is an optional parameter and this test case is configured without folder name.</li>
 * </ul>
 */
@Test
@MobileTest(appPath = "selion-hub-storage:guid:selendroid-test-app-0.15.0.apk", device = "android:5.0.1", deviceType = "Android Emulator")
public void testWithNativeAppWithSelionHub() {
    RemoteWebDriver driver = Grid.driver();
    WebDriverWaitUtils.waitUntilElementIsVisible("io.selendroid.testapp:id/my_text_field");
    WebElement textField = driver.findElement(By.id("io.selendroid.testapp:id/my_text_field"));
    assertEquals("true", textField.getAttribute("enabled"));
    textField.sendKeys("Appium Android Native Test");
    assertEquals("Appium Android Native Test", textField.getText());
}

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

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against IOS safari using appium.
 * <ul>/* w  w w .j  av a  2  s  .c  o  m*/
 * <li>
 * An appium instance/server should be installed and running where selenium host and port should be 
 * configured to the same appium instance.</li> 
 * <li>
 * For setting up Appium iOS refer http://appium.io/slate/en/master/?ruby#system-setup-(ios)
 * </li>
 * </ul>
 */
@Test
@MobileTest(appName = "safari", device = "iphone:8.1", deviceType = "iPhone Simulator")
public void testWithSafari() {
    //To gain access to the IOSRemoteWebDriver, we use the thread safe helper method Grid.driver() which provides
    //an instance of IOSRemoteWebDriver for the current Test method. 
    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();
    // take a screenshot
    SeLionReporter.log("cheese!", true);
}

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

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against a Native ANDROID app in sauce cloud.
 * This selendroid-test-app-0.15.0.apk must be uploaded to sauce temporary storage before running this test case.
 *///from   w  w  w.ja v a 2s.  c  om
@Test
@MobileTest(appPath = "sauce-storage:selendroid-test-app-0.15.0.apk", device = "android:4.3", deviceType = "Android Emulator", additionalCapabilities = {
        "appiumVersion:1.4.13" })
public void testWithNativeAndroidApp() throws Exception {
    RemoteWebDriver driver = Grid.driver();
    WebDriverWaitUtils.waitUntilElementIsVisible("io.selendroid.testapp:id/my_text_field");
    WebElement textField = driver.findElement(By.id("io.selendroid.testapp:id/my_text_field"));
    assertEquals("true", textField.getAttribute("enabled"));
    textField.sendKeys("Appium Android Native Test");
    assertEquals("Appium Android Native Test", textField.getText());

}

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

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against ANDROID browser using selendroid.
 *//* w  w w  . j av a2  s.  c o m*/
@Test
@MobileTest(appName = "android", device = "android:19")
public void testLaunch() throws Exception {
    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, true);
}

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

License:Apache License

/**
 * This test demonstrates how to use SeLion for running tests against ANDROID native app using selendroid.
 *///from  www  .j av  a2  s  .  c o m
@Test
@MobileTest(appName = "io.selendroid.testapp:0.15.0", device = "android:19")
public void testNative() {
    RemoteWebDriver driver = Grid.driver();
    WebDriverWaitUtils.waitUntilElementIsVisible("//EditText[@id='my_text_field']");
    WebElement inputField = driver.findElement(By.xpath("//EditText[@id='my_text_field']"));
    assertEquals(inputField.getAttribute("enabled"), "true");
    inputField.sendKeys("Selendroid");
    assertEquals(inputField.getText(), "Selendroid");
}