app自动化需要修改手机系统语言为英语、法语、俄语等,除了进入系统设置一步一步设置,有什么其他快捷的办法吗?

如果进入手机系统设置每个手机厂商的不同系统版本都需要写个对应的方法,太多精力放到这里很不合适,有adb命令或者appium的某个方法能直接修改吗?目前百度等都没有找到资料,adb的网上说的自己试验了,也是失败的。

可以使用这个命令直接打开设置语言的页面,然后使用Appium设置对应的语言即可
adb shell am start -a android.settings.LOCALE_SETTINGS

android.settings.LOCALE_SETTINGS是一个activity吗?
为什么使用driver.start_activity(app_package=“com.android.settings”, app_activity=“android.settings.LOCALE_SETTINGS”)报没有权限?报错信息如下:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘com.android.settings’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Cannot start the ‘com.android.settings’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name ‘.android.settings.LOCALE_SETTINGS’ used to start the app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘com.android.settings’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Cannot start the ‘com.android.settings’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name ‘.android.settings.LOCALE_SETTINGS’ used to start the app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
at getResponseForW3CError (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)

你可以用python执行命令行命令,我是在命令行直接操作的

命令行和Python都可以使用,我们框架原则上尽量少的使用adb命令,尽量使用appium自动的函数方法,driver.start_activity封装的也是adb shell am start命令,所以我就用这个了,发现没有权限,

adb shell am start -a android.settings.LOCALE_SETTINGS
这里的-a代表什么?

使用这个adb命令报的这个


这个adb命令没有启动Activity

这个只是警告,你看页面打开了吗

谢谢老师,问题已解决