【发布时间】:2021-09-14 11:15:25
【问题描述】:
我需要在安卓设备上运行移动浏览器,但是我遇到了这个错误
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'adb -P 5037 -s emulator-5554 shell pm clear com.android.chrome' exited with code 255'; Stderr: 'Security exception: adb clearing user data is forbidden.
java.lang.SecurityException: adb clearing user data is forbidden.
at com.android.server.am.ActivityManagerService.clearApplicationUserData(ActivityManagerService.java:7612)
at com.android.server.pm.PackageManagerShellCommand.runClear(PackageManagerShellCommand.java:1616)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:199)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:24713)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3075)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4713)
at android.os.Binder.execTransact(Binder.java:731)'; Code: '255'
androidUseRunningApp 或 noReset True 不适合我
现在有人如何克服这个错误吗? 这就是我正在尝试的
AndroidConnection
${Options} Create Dictionary androidPackage com.android.chrome
${caps} Create Dictionary chromeOptions ${Options}
Set to Dictionary ${caps} platformName Android
Set to Dictionary ${caps} platformVersion 9.0
Set To Dictionary ${caps} deviceName emulator-5554
Set To Dictionary ${caps} browserName Chrome
Set To Dictionary ${caps} noReset true
Create Webdriver Remote command_executor=http://localhost:4723/wd/hub desired_capabilities=${caps}
go to https://google.com
Close Browser
AndroidConnection
${Options} Create Dictionary androidPackage com.android.chrome
${caps} Create Dictionary chromeOptions ${Options}
Set to Dictionary ${caps} platformName Android
Set to Dictionary ${caps} platformVersion 9.0
Set To Dictionary ${caps} deviceName emulator-5554
Set To Dictionary ${caps} browserName Chrome
Set To Dictionary ${caps} androidUseRunningApp true
Create Webdriver Remote command_executor=http://localhost:4723/wd/hub desired_capabilities=${caps}
go to https://google.com
Close Browser
【问题讨论】:
-
你在使用root设备吗?
-
不,我使用的是无根设备(Realme C2)
标签: selenium selenium-chromedriver appium robotframework