如何使用appium在android中进行web测试

如何使用appium在android中进行web测试,android,web-testing,appium,Android,Web Testing,Appium,我单击appium.exe UI中的启动按钮而不进行配置。当我运行以下代码时,我的android emulator中没有首选项。如何在带有appium的android emulator中启动chrome浏览器 //setup the web driver and launch the webview app. DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCa

我单击appium.exe UI中的启动按钮而不进行配置。当我运行以下代码时,我的android emulator中没有首选项。如何在带有appium的android emulator中启动chrome浏览器

//setup the web driver and launch the webview app.
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("app", "chrome");
desiredCapabilities.setCapability("device", "Android");
URL url = null;
try {
url = new URL("http://localhost:4723/wd/hub");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities);

// Navigate to the page and interact with the elements on the guinea-pig page using id.
remoteWebDriver.get("http://saucelabs.com/test/guinea-pig");
WebElement div = remoteWebDriver.findElement(By.id("i_am_an_id"));
Assert.assertEquals("I am a div", div.getText()); 
//check the text retrieved matches expected value
remoteWebDriver.findElement(By.id("comments")).sendKeys("My comment"); 
//populate the comments field by id.

//close the app.
remoteWebDriver.quit();

SauceLab的Android模拟器上没有安装Chrome,因此您将无法启动Chrome。除此之外,Appium通过saucelabs不支持web测试

你能指出一个SauceLabs页面显示“Appium不支持通过SauceLabs进行web测试”吗?我找不到我在哪里找到这条信息。如果不是真的,请告诉我,我会记下来的。我将继续搜索,看看是否能找到它并将其发布在这里。@JeffH我没有找到关于这一点的saucelabs文档。相反,这是我在appium的谷歌讨论中得到的答案:我认为OP使用的是本地appium实例和本地android设备,而不是saucelabs。