【问题标题】:how to do web test in android with appium如何使用appium在android中进行网络测试
【发布时间】:2013-11-24 09:53:19
【问题描述】:

我单击 appium.exe UI 中的启动按钮而不对其进行配置。当我运行以下代码时,我的 android 模拟器中没有偏好。如何在带有 appium 的 android 模拟器中启动 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();

【问题讨论】:

    标签: android web-testing appium


    【解决方案1】:

    Chrome 未安装在 SauceLab 的 Android 模拟器上,因此您将无法启动 chrome。最重要的是,Appium 不支持通过 saucelabs 进行 Web 测试。

    【讨论】:

    • 您能否指向一个显示“Appium 通过 saucelabs 不支持 Web 测试”的 SauceLabs 页面?
    • 我找不到该信息的位置。如果它不是真的,请告诉我,我会删除它。我会继续搜索看看能不能找到并贴在这里。
    • @JeffH 我没有找到有关此的 saucelabs 文档。相反,这是我在 appium 的谷歌讨论中得到的答案:groups.google.com/d/msg/appium-discuss/0VZqvR4rAoc/uyA0k_dP40EJ
    • 我认为 OP 使用的是本地 appium 实例和本地 android 设备,而不是 saucelabs。
    猜你喜欢
    • 2013-05-24
    • 2015-01-04
    • 2020-12-02
    • 2016-09-25
    • 2014-08-03
    • 2020-05-02
    • 2012-08-19
    • 2015-08-11
    • 2021-10-18
    相关资源
    最近更新 更多