Android 模拟器未启动。总是为 browserName 抛出错误,但不包含在大写中

Android emulator not started. always throwing error for browserName while not include in caps

我正在尝试自动化 appium android 但所需的功能总是会为 sauce labs 抛出错误,例如:

Unable to parse remote response: Cannot specify both browserName and app caps.

我还没有在 cap 中添加 browserName 它仍然在请求中显示密钥 JSON

我还使用 curl 命令在服务器上上传了 apk

完整错误:

Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to parse remote response: Cannot specify both browserName and app caps. Please check our platforms configurator (https://wiki.saucelabs.com/display/DOCS/Platform+Configurator): {'deviceName': 'Android Emulator', 'app': 'sauce-storage:HelloGappium-android.zip', 'platform': 'ANDROID', 'browserName': 'chrome', 'version': '', 'deviceType': 'phone', 'deviceOrientation': 'portrait', 'platformVersion': '4.4', 'platformName': 'Android', 'appiumVersion': '1.5.1'} Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z' System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131' Driver info: driver.version: AndroidDriver at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:111) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:83) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:93) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:72) at test.java.sauceLabs.HybridBaseSauceLabs.capabilities(HybridBaseSauceLabs.java:37) at test.java.sauceLabs.HybridBasetestcase.main(HybridBasetestcase.java:26)

我的代码:

public static AndroidDriver<AndroidElement> capabilities() throws MalformedURLException 
{

DesiredCapabilities caps = DesiredCapabilities.android(); 
caps.setCapability("appiumVersion", "1.5.1"); 
caps.setCapability("deviceName","Android Emulator"); 
caps.setCapability("deviceType","phone"); 
caps.setCapability("deviceOrientation", "portrait"); 
caps.setCapability("platformVersion", "4.4"); 
caps.setCapability("platformName","Android"); 
caps.setCapability("app","sauce-storage:HelloGappium-android.zip");

driver = new AndroidDriver<>(new URL(URL), caps); 

return driver; 
}

如果我是 sauce labs 的新手,如果我遗漏了什么请告诉我

请分享您针对 android

酱汁实验室的工作上限

Here 你可以找到平台配置器。 Sauce Labs 提供它以帮助获得您需要的正确瓶盖。根据您的配置,web 测试的正确上限如下所示:

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

对于 HybridApp 测试,browserName 将设置为:

caps.setCapability("browserName", "");