Java 类org.openqa.selenium.android.AndroidDriver 实例源码

项目:android-webdriver-vm-demo    文件:TMGoogle.java   
@Test
public void testGoogle() throws Exception {
  try {
    WebDriver driver = new AndroidDriver();

    // 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();

    // Check the title of the page
    System.out.println("Page title is: " + driver.getTitle());
    driver.quit();
  } catch (Exception e) {
    e.printStackTrace();
  }
}
项目:android-webdriver-vm-demo    文件:TMTest.java   
public void setDriver()
{
  try
  {
    driver = new AndroidDriver();
  }
  catch(UnreachableBrowserException e)
  {
    System.out.println("Could not set driver...");
  }
}
项目:crawljax    文件:WebDriverBrowserBuilder.java   
/**
 * Build a new WebDriver based EmbeddedBrowser.
 * 
 * @return the new build WebDriver based embeddedBrowser
 */
@Override
public EmbeddedBrowser get() {
    LOGGER.debug("Setting up a Browser");
    // Retrieve the config values used
    ImmutableSortedSet<String> filterAttributes =
            configuration.getCrawlRules().getPreCrawlConfig().getFilterAttributeNames();
    long crawlWaitReload = configuration.getCrawlRules().getWaitAfterReloadUrl();
    long crawlWaitEvent = configuration.getCrawlRules().getWaitAfterEvent();

    // Determine the requested browser type
    EmbeddedBrowser browser = null;
    switch (configuration.getBrowserConfig().getBrowsertype()) {
        case FIREFOX:
            browser = newFireFoxBrowser(filterAttributes, crawlWaitReload, crawlWaitEvent);
            break;
        case INTERNET_EXPLORER:
            browser = WebDriverBackedEmbeddedBrowser.withDriver(new InternetExplorerDriver(),
                    filterAttributes, crawlWaitEvent, crawlWaitReload);
            break;
        case CHROME:
            browser = newChromeBrowser(filterAttributes, crawlWaitReload, crawlWaitEvent);
            break;

        case REMOTE:
            browser = WebDriverBackedEmbeddedBrowser.withRemoteDriver(configuration
                    .getBrowserConfig().getRemoteHubUrl(), filterAttributes, crawlWaitEvent,
                    crawlWaitReload);
            break;
        case ANDROID:
            browser = WebDriverBackedEmbeddedBrowser.withDriver(new AndroidDriver(),
                    filterAttributes, crawlWaitEvent, crawlWaitReload);
            break;

        default:
            throw new IllegalStateException("Unrecognized browsertype "
                    + configuration.getBrowserConfig().getBrowsertype());
    }
    plugins.runOnBrowserCreatedPlugins(browser);
    return browser;
}
项目:androidtestdebug    文件:FirstDemo.java   
@Before
public void setUp() throws Exception {
  driver = new AndroidDriver();
  baseUrl = "http://www.baidu.com/";
  driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}