我试图在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的功能,这不是我需要的东西。
提前致谢。
答案 0 :(得分:1)
根据https://support.saucelabs.com/entries/51370580-Android-Desired-Capabilities上的文档,您不需要apk功能,但您需要包含" browserName"一。
所以你应该添加:
capabilities.setCapability("browserName", "browser");
这可能还需要:
capabilities.setCapability(CapabilityType.BROWSER_NAME, "browser");
以下是关于Android上移动网络测试的文档中的完整示例:
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'
答案 1 :(得分: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#/