Hey,
I have just upgraded from Java client 9.1.0 to 9.3.0 and I had to switch from using DesiredCapabilities to BaseOptions/UiAutomator2Options.
Everything else stays the same, so when I try to run a test on an emulator, I’m getting this error:
Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Cannot set the device locale to ‘it_IT’. You may want to apply one of the following locales instead: ca_IT,de_IT,fur_IT,it_CH,it_IT,it_SM,it_VA
The error is suggesting to use the same locale as I’m actually using.
I tried using UiAutomator2Options and set the locale and language by:
options.setLocale("IT")
options.setLanguage("it")
The other try was by using the BaseOptions and setting it like this:
baseOptions.amend(UiAutomator2Options.LANGUAGE_OPTION, "it");
baseOptions.amend(UiAutomator2Options.LOCALE_OPTION, "IT");
…but the error is the same.
Any idea why this is happening?
wreed
October 29, 2024, 3:37pm
2
I think you are seeing this:
opened 05:37AM - 19 Jun 24 UTC
closed 09:41AM - 19 Jun 24 UTC
question
## Description
We are noticing that in 9.2.3, the java client is no more appe… nding prefix 'appium:' to the capabilities when we set those using DesiredCapabilities class. Is this intentional or a bug?
## Environment
* Java client build version or git revision if you use some snapshot: 9.2.3
* Appium server version or git revision if you use some snapshot: Latest
* Desktop OS/version used to run Appium if necessary: Mac OS
* Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 21
* Mobile platform/version under test: Android 14
* Real device or emulator/simulator: Both
## Code To Reproduce Issue [ Good To Have ]
Set capabilities as well and try to create a driver session:
```
DesiredCapabilities caps =new DesiredCapabilities();
caps.setCapability("platformName", "Android");
caps.setCapability("deviceName", "device_name");
caps.setCapability("automationName", "UiAutomator2");
caps.setCapability("udid", "emulator-5554");
caps.setCapability("app", "file_path");
```
## Exception Stacktraces
You can see in the exception trace, the client hasn't appended 'appium:' prefix to the capabilities.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Host info: host: 'name', ip: 'ip'Build info: version: '4.21.0', revision: '79ed462ef4'System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.5', java.version: '17.0.8'Driver info: io.appium.java_client.android.AndroidDriverCommand: [null, newSession {capabilities=[Capabilities {app: /file_path..., automationName: UiAutomator2, deviceName:device_name, platformName: ANDROID, udid: emulator-5554}]}]Capabilities {app: /file_path..., automationName: UiAutomator2, deviceName:device_name, platformName: ANDROID, udid: emulator-5554} at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:536) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:109) at [sampleoad.run](https://sampleoad.run/).main(run.java:33)Caused by: **java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [app, automationName, deviceName, udid]** at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$5(NewSessionPayload.java:163) at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:540) at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:167) at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:70) at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:99) at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:84) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:60) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
## Link To Appium Logs
The client errors out before sending the request to the server.
Not sure about the locale issue. Are you using UiAutomator2Options like the example on Github?
Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Please provide the full server log. The device logcat output might also be useful
Thank you both for your replies. @wreed , yeah I checked those and updated the code accordingly.
However, I was about to get the Server logs and record logcat, but today it just magically works. I’m using the same code as in my initial post, I haven’t changed anything.
It might be that I needed to restart my PC for some reason, idk.
Thx again
1 Like