LambdaTest Appium Integration : Driver session Response code 400. Message: unsupported platfrom ANDROID

211 views Asked by At

I have configured my automation app to run appium on lambdatest. But I am getting the below error where it is unable to create the driver session

Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[{browserName=Chrome, appium:deviceName=Google Pixel 7 Pro, platformName=ANDROID, appium:platformVersion=13}], desiredCapabilities=Capabilities {browserName: Chrome, deviceName: Google Pixel 7 Pro, platformName: ANDROID, platformVersion: 13}}]
Capabilities {browserName: Chrome, deviceName: Google Pixel 7 Pro, platformName: ANDROID, platformVersion: 13}
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: unsupported platfrom ANDROID 

The platform name in my code is Android but it gets converted to all caps internally. I am running the below selenium and appium versions.

<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.9.1</version>
        </dependency>
<dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>8.5.1</version> <!-- Specify the desired version -->
        </dependency>

Please let me know if there are any workarounds or any lower versions with which this might execute.

2

There are 2 answers

0
anjana On BEST ANSWER

The desired capabilities details had to be passed as a map along with a w3c parameter for this to work. Given below is the code that worked for me.

DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> ltOptions = new HashMap<String, Object>();
ltOptions.put("w3c", true);
ltOptions.put("platformName", "android");
ltOptions.put("deviceName", "Pixel 6");
ltOptions.put("platformVersion", "13");
ltOptions.put("isRealMobile", true);
capabilities.setCapability("lt:options", ltOptions);
2
Dima Berezovskyi On
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "android");
capabilities.setCapability("deviceName", "Pixel 3");
capabilities.setCapability("platformVersion", "9");
capabilities.setCapability("isRealMobile", true);

Caps generator

change ANDROID to android