if(automationtype.equalIgnoreCase("Mobile")) driver=new AndroidDriver(); else driver=new WebDriver();
WebDriver driver = new AndroidDriver(); and change it to WebDriver driver = new AndroidDriver("http://remote machine ip:8081/wd/hub/");
protected WebDriver getAndroidDriver() { return new AndroidDriver(); }
WebDriver driver = new AndroidDriver( new URL("http://localhost:8080/hub") );
WebDriver driver = new AndroidDriver( new URL("http://localhost:8090/wd/hub") );
driver = new AndroidDriver(new URL("http://127.0.0.1:" + "4723" + /wd/hub"), cap);
AndroidDriver adriver = new AndroidDriver(new Url("127.0.0.1:4725/wd/hub", caps));
driver = new AndroidDriver(); driver = (new Augmenter()).augment(driver); File temp = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(temp, new File("C:\\my\\picture\\test.png"));
public void testGoogle() throws Exception { WebDriver driver = new AndroidDriver(); driver.get("http://www.google.co.in"); Thread.sleep(4000); WebElement element = driver.findElement(By.name("q")); element.sendKeys("Welcome"); element.submit(); System.out.println("Page title is: " + driver.getTitle()); driver.quit(); }
protected WebDriver createAndroidDriver() { try { String url = System.getProperty("webdriver.android.url", "http://localhost:8080/hub"); ScreenOrientation screenOrientation = ScreenOrientation.valueOf(System.getProperty( "webdriver.android.screenOrientation", "portrait").toUpperCase(usingLocale())); AndroidDriver driver = new AndroidDriver(url); driver.rotate(screenOrientation); return driver; } catch (MalformedURLException e) { throw new UnsupportedOperationException(e); } }
import junit.framework.TestCase; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.android.AndroidDriver; public class OneTest extends TestCase { public void testGoogle() throws Exception { 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(); } }
@Test public void testByClauses() throws Exception { AndroidDriver driver = new AndroidDriver(); // driver.get("http://www.google.co.uk/"); driver.get("file:///sdcard/form.html"); System.out.println(driver.getPageSource()); WebElement nameElement = driver.findElement(By.name("q")); WebElement xpathElement = driver.findElement(By.xpath("//*[@id='gbqfq']")); WebElement cssElement = driver.findElement(By.cssSelector("#gbqfq")); nameElement.sendKeys("android "); xpathElement.sendKeys("driver "); cssElement.sendKeys("webdriver"); nameElement.submit(); System.out.println("Page title is: " + driver.getTitle()); driver.quit(); }
break; case ANDROID: driverObject = new AndroidDriver(); logger.debug("Using Android Driver..."); break;
return WebDriverBackedEmbeddedBrowser.withDriver(new AndroidDriver(), configuration.getFilterAttributeNames(), configuration .getCrawlSpecificationReader().getWaitAfterEvent(), configuration