Last active
August 29, 2015 14:16
-
-
Save DominikDary/b8585beb8dfb1f6d9c92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package io.selendroid.standalone.server.handler; | |
import org.junit.Test; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.chrome.ChromeDriverService; | |
import org.openqa.selenium.chrome.ChromeOptions; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
/** | |
* @author dary | |
* | |
*/ | |
public class AndroidHybridAppChromeDriverTest { | |
@Test | |
public void testChromeDriver() throws Exception { | |
ChromeDriverService service = startChromeDriver(); | |
DesiredCapabilities capa = new DesiredCapabilities(); | |
capa.setCapability("platform", "android"); | |
capa.setCapability("browserName", "android"); | |
ChromeOptions options = new ChromeOptions(); | |
options.setExperimentalOption("androidUseRunningApp", true); | |
options.setExperimentalOption("androidDeviceSerial", "emulator-5554"); | |
options.setExperimentalOption("androidPackage", | |
"io.selendroid.androiddriver"); | |
capa.setCapability("chromeOptions", options); | |
System.out.println("url: " + service.getUrl()); | |
WebDriver driver = new RemoteWebDriver(service.getUrl(), capa); | |
System.out.println(driver.getPageSource()); | |
driver.quit(); | |
} | |
private ChromeDriverService startChromeDriver() throws Exception { | |
System.setProperty("webdriver.chrome.driver", | |
"/Users/dary.de/bin/chromedriver"); | |
ChromeDriverService chromeDriverService = ChromeDriverService | |
.createDefaultService(); | |
chromeDriverService.start(); | |
return chromeDriverService; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment