测试积点老人 发表于 2020-11-11 10:13:29

Appium运行报错:does not have permission android.permission.CLEAR_APP_USER_DA...

Appium运行报错:does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package环境是Appium+TestNG+Java,环境配置肯定正确,因为我用了别的设备是可以运行起来的出错的设备是OPPO R15 Android 8.1曾经怀疑是Android 8.1的问题,但是用其他Android 8.1的设备可以正常运行Appium:Java脚本:报错如下:FAILED CONFIGURATION: @BeforeTest beforeTest
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot stop and clear com.toinn.android.applaunch. Original error: Error executing adbExec. Original error: 'Command 'E\:\\AndroidSDK\\platform-tools\\adb.exe -P 5037 -s 93d2aa4c shell pm clear com.toinn.android.applaunch' exited with code 1'; Stderr: 'Error: java.lang.SecurityException: PID 9904 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.toinn.android.applaunch'; Code: '1' (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.93 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'TUY-PC', ip: '192.168.165.2', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_121'
Driver info: io.appium.java_client.android.AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:161)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:170)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:82)
at com.ty.base.Init.beforeTest(Init.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.TestRunner.beforeRun(TestRunner.java:647)
at org.testng.TestRunner.run(TestRunner.java:615)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)


bellas 发表于 2020-11-12 09:54:27

环境文件没有配置

qqq911 发表于 2020-11-12 10:14:54

看报错是说没权限,可以试试root

郭小贱 发表于 2020-11-12 10:40:34

需要开启开发者选项中的OEM解锁.

海海豚 发表于 2020-11-12 14:26:59

https://blog.csdn.net/shandong_chu/article/details/105144785   看下这个步骤

jingzizx 发表于 2020-11-12 15:59:17

没有权限啊
页: [1]
查看完整版本: Appium运行报错:does not have permission android.permission.CLEAR_APP_USER_DA...