1

我正在尝试在 saucelabs 上运行带有 webdriver 的 android 模拟器来测试一些网页。这就是我正在使用的能力:

        Capabilities capabilities = DesiredCapabilities.android()
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("platformVersion", "4.2");
        capabilities.setCapability("deviceName", "Android Emulator");
        capabilities.setCapability("deviceType", "phone");
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android")

然而,这给了我一个错误:

org.openqa.selenium.WebDriverException: Sauce could not start your job. For more information on what happened, please visit (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 21.74 seconds

我找到的所有教程和答案都包括安装 apk 的功能,这不是我需要的。

提前致谢。

4

2 回答 2

1

根据https://support.saucelabs.com/entries/51370580-Android-Desired-Capabilities上的文档,您不需要 apk 功能,但需要包含“browserName”之一。

所以你应该添加:

capabilities.setCapability("browserName", "browser");

这可能还需要:

capabilities.setCapability(CapabilityType.BROWSER_NAME, "browser");

以下是他们文档中关于 Android 上的移动 Web 测试的完整示例:

self.desired_capabilities = {}
self.desired_capabilities['platformName'] = 'android'
self.desired_capabilities['platformVersion'] = '4.4'
self.desired_capabilities['browserName'] = 'browser'
self.desired_capabilities['deviceName'] = 'Android' 
self.desired_capabilities['appiumVersion'] = '1.2.2'
于 2014-08-28T05:20:47.433 回答
1

根据您是使用 Selenium 还是 Appium 来运行移动 Web 测试,这里有两组所需的功能。

硒:

DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("platform", "Linux");
caps.setCapability("version", "4.4");
caps.setCapability("deviceName","Android Emulator");
caps.setCapability("deviceType","phone");
caps.setCapability("deviceOrientation", "portrait");

Appium:

DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("appiumVersion", "1.5.0");
caps.setCapability("deviceName","Android Emulator");
caps.setCapability("deviceType","phone");
caps.setCapability("deviceOrientation", "portrait");
caps.setCapability("browserName", "Browser");
caps.setCapability("platformVersion", "4.4");
caps.setCapability("platformName","Android");

这两种配置都将成功连接到 Sauce Labs。

资源:

https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/

于 2016-03-18T20:00:32.147 回答