Reputation: 17553
I am trying to automate appium android but the desired capability always throw error for sauce labs like:
Unable to parse remote response: Cannot specify both browserName and app caps.
I haven't add browserName in cap still it is showing key in request JSON
I have also upload apk on server using curl command
Full error:
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)
My code:
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;
}
Please let me know if I am missing anything as I am new to sauce labs
Please share your working caps for sauce labs specific to android
Upvotes: 0
Views: 692
Reputation: 6900
Here you can find the platform configurator. Sauce Labs supply it to help with getting the right caps which is what you need. Based on your configuration, the correct caps will look like this for web testing:
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");
for Hybrid or App testing, the browserName
will be set as:
caps.setCapability("browserName", "");
Upvotes: 1