vendredi 23 mars 2018

Changing language via Appium capabilities on Android API <= 23

I´m writing automated tests on Android devices using Appium. I need to set different languages and to do that I´m using language and locale capabilities and set them like following:

capabilities["language"] = "sv"
capabilities["locale"] = "SE"

It works great on Android Emulators (v 6.0 / API 23, v7.1.1 / API 25). It works on different real devices with OS 7.0 (API 24) and higher. It does NOT work on real devices with API 23 and lower. I always receive an error:

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Failed to set language: sv and country: SE

I´ve tried different combinations like locale set on sv_SE sv-SE etc. but nothing helps.

Logs:

[Appium] Creating new AndroidDriver (v1.37.0) session
[Appium] Capabilities:
[Appium]   app: [...]
[Appium]   language: sv
[Appium]   locale: SE
[Appium]   appWaitActivity: [...] 
[Appium]   deviceName: [...]
[Appium]   platformVersion: 5.0.1
[Appium]   platformName: Android 
[BaseDriver] Session created with session id: df43e233-b4fe-47e8-8d27-c8c7eff12a69
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_161
[ADB] Checking whether adb is present
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '5.0.1'
[ADB] Setting device id to 6bfdb679
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","ro.build.version.release"]
[ADB] Current device property 'ro.build.version.release': 5.0.1
[AndroidDriver] Using device: 6bfdb679
[ADB] Checking whether adb is present
[ADB] Setting device id to 6bfdb679
[BaseDriver] Using local app [...]
[AndroidDriver] Checking whether app is actually present
[AndroidDriver] Starting Android session
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","echo","ping"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","ro.build.version.sdk"]
[ADB] Current device property 'ro.build.version.sdk': 21
[ADB] Device API level: 21
[ADB] Device API level: 21
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","persist.sys.language"]
[ADB] Current device property 'persist.sys.language': en
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","persist.sys.country"]
[ADB] Current device property 'persist.sys.country': GB
[ADB] Device API level: 21
[ADB] Setting device property 'persist.sys.language' to 'sv'
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","setprop","persist.sys.language","sv"]
[ADB] Device API level: 21
[ADB] Setting device property 'persist.sys.country' to 'SE'
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","setprop","persist.sys.country","SE"]
[ADB] Rebooting the device in order to apply new locale via 'setting persist.sys.locale' command.
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","stop"]
[ADB] Device API level: 21
[ADB] Setting device property 'sys.boot_completed' to '0'
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","setprop","sys.boot_completed",0]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","start"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","sys.boot_completed"]
[ADB] Current device property 'sys.boot_completed': 1
[ADB] Device API level: 21
[ADB] Device API level: 21
[ADB] Getting connected devices...
[ADB] Unable to unroot adb daemon: 'Command ''C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools\\adb.exe' unroot' exited with code 1'. Continuing
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","persist.sys.language"]
[ADB] Current device property 'persist.sys.language': en
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","getprop","persist.sys.country"]
[ADB] Current device property 'persist.sys.country': GB
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","6bfdb679","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Failed to set language: sv and country: SE

Aucun commentaire:

Enregistrer un commentaire