在APK中通过adb shell命令启动UIautomator失败

源码如下:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
Button stButton = (Button)findViewById(R.id.start_test);
stButton.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                            // TODO Auto-generated method stub
                            try {
                                    Process pro = Runtime
                                                    .getRuntime()
                                                    .exec("uiautomator runtest TestHiDP.jar -c com.huawei.cases.TestAllCase");
                            } catch (Exception e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                            }
                    }
            });

    }

报错信息为:
12-03 08:17:24.452: E/UiAutomatorTestRunner(6046): java.lang.RuntimeException: Didn't find class "com.huawei.cases.TestAllCase" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/uiautomator.jar", zip file "/data/local/tmp/TestHiDP.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
12-03 08:17:24.452: E/UiAutomatorTestRunner(6046): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.huawei.cases.TestAllCase" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/uiautomator.jar", zip file "/data/local/tmp/TestHiDP.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

我在pc端输入“adb shell uiautomator runtest TestHiDP.jar -c com.huawei.cases.TestAllCase”是可以正常启动的。
手机端的APK有android:sharedUserId="android.uid.system",使用的是系统签名。在android 4.0的高通平台手机上可以运行,在MTK某些平台的手机上运行不了。在android 5.0上就都运行不了了。请大神帮忙看看
是不是权限,还是什么问题?

5个回答

这个问题折腾了这么久,我这里把原因贴出来,供大家分享,有错误的地方也请大家指正。
通过apk启动Uiautomator,在android 4.4可以,而5.0不可用,是因为我的apk使用的是systemId,在4.4上没有对用户权限进行限制。而5.0上强制开启了SELinux,这样对systemID的访问权限就限制了,因为/data/local/tmp目录的用户和属组是shell:shell,所以解决方法是,把APK改成shellID进行访问,就好了

错误信息里提示运行时并未找到该类,所以应该是版本的问题,可能不同手机平台的安卓版本移除了一些包。

lifei396069574
啊啊啊飞 求助 大神 怎么解决的这个问题
大约 2 年之前 回复
qq_27744449
zane-liu 回复不知取啥名: 你在手机方案公司?同行
接近 4 年之前 回复
shj0605010318
不知取啥名 具体我也不太清楚,刚入门的小白,哈哈
接近 4 年之前 回复

你好LZ我这几天也在做这个东西,遇到了同样的问题,我对你的回复有一些疑问,“把APK改成shellID进行访问,就好了”shellID这个是什么?是我已通过adb shell进去后得到的这个吗?root@cancro:/ # ,还有是在manifest文件中修改apk改成shellID吗?能把你的这个修改的代码给个参考吗?,谢谢,另外我这边使用的是小米手机还报了一些虚拟机权限的问题,
Could not create image space with image file '/system/framework/boot.art'. Attempting to fall back to imageless running. Error was: Requiring relocation for image '/system/framework/boot.art' at '/system/framework/arm/boot.art' but we do not have any dalvik_cache to find/place it in.
No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "com.android.commands.uiautomator.Launcher" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/uiautomator.jar", zip file "/data/local/tmp/UiautomatorFunction.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

之类的东西,我和你一样直接使用adb shell uiautomator是没有问题的,4.4.4的小米也没问题我怀疑是apk中调用的uiautomator和直接adb shell调用的不是一个,默认是不是/system/bin
希望能尽快得到你的恢复,谢谢

kobe90yuan
Kobe_Yuan 回复不知取啥名: 求工号,也遇到这个问题了
接近 4 年之前 回复
shj0605010318
不知取啥名 还有是在manifest文件中修改apk改成shellID吗?——对的,就是这样改的,然后还要用shellID对应的key文件(这个是开发提供的),另外开发编译版本把我们的APK也内置到手机版本,赋予shell用户权限。另外,不好意思,公司的代码不能外传,上不了外网。
接近 4 年之前 回复
shj0605010318
不知取啥名 不好意思,最近都没有上论坛。今天才看到消息,shellID就是要有shell权限的属组和权限。因为我们测试的是自己公司的手机。我们在开发测试版本时,给我们的测试工具APK赋予了shell用户权限,这样就这个apk就可以启动uiautomator脚本程序了。其他公司的手机,即使root了,也还是不行。需要开发在编译版本对测试APK的权限进行修改。
接近 4 年之前 回复

以前我也遇到了,android:sharedUserId="android.uid.system"权限改下android:sharedUserId="android.uid.shell"即可。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
android studio 的UIAutomator用例 如何通过adb 启动

现在在AS 上写了个uiautomator的用例,但是每次要测都要打开AS run这个test工程,现在是想是否可用adb命令来做,这样就可以写个脚本来用了。。但是死活不知如何启动。 Installing APK: H:\dev\AndroidStudioProjects\MyApplication\testapp\build\outputs\apk\testapp-debug.apk Uploading file to: /data/local/tmp/com.example.android.testing.uiautomator.BasicSample Installing com.example.android.testing.uiautomator.BasicSample DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.android.testing.uiautomator.BasicSample" pkg: /data/local/tmp/com.example.android.testing.uiautomator.BasicSample Success Installing APK: H:\dev\AndroidStudioProjects\MyApplication\testapp\build\outputs\apk\testapp-debug-androidTest-unaligned.apk Uploading file to: /data/local/tmp/com.example.android.testing.uiautomator.BasicSample.test Installing com.example.android.testing.uiautomator.BasicSample.test DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.android.testing.uiautomator.BasicSample.test" pkg: /data/local/tmp/com.example.android.testing.uiautomator.BasicSample.test Success **********************以上的都是可以的,但是安装完后不知如果做以下操作 Running tests Test running startedFinish

uiautomator 命令如何 在 android 中调用

在cmd中运行 adb push F:\***\AutoRunner.jar data/local/tmp/AutoRunner.jar adb shell uiautomator runtest AutoRunner.jar -c com.Runner.AutoRunner 能正常运行,手机上(android4.1.2)也有效果。 但是我想在一个安卓应用上(比如一个按钮隐藏当前应用后运行)调用adb shell uiautomator runtest ...命令。 运行: Runtime.getRuntime().exec("am start -n com.tencent.mm/com.tencent.mm.ui.LauncherUI") 能正常打开微信。但是运行下面的语句,没有任何效果: Runtime.getRuntime().exec("uiautomator runtest data/local/tmp/AutoRunner.jar -c com.Runner.AutoRunner") 大家有没有办法(其他办法也行),在安卓中触发uiautomator。

appium-desktop启动模拟器adb命令超时失败

1appium-desktop启动模拟器adb命令超时失败 2.使用appium-server启动没有问题 报错如下: ``` [Appium] Welcome to Appium v1.15.0 [Appium] Non-default server args: [Appium] allowInsecure: { [Appium] } [Appium] denyInsecure: { [Appium] } [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session [HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android"}},"desiredCapabilities":{"platformName":"Android","platformVersion":"5.1.1","deviceName":"Android Emulator","appPackage":"com.android.calculator2","appActivity":".Calculator"}} [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","platformVersion":"5.1.1","deviceName":"Android Emulator","appPackage":"com.android.calculator2","appActivity":".Calculator"},null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android"}}] [BaseDriver] Event 'newSessionRequested' logged at 1571708607532 (09:43:27 GMT+0800 (中国标准时间)) [Appium] Could not parse W3C capabilities: 'deviceName' can't be blank [Appium] Trying to fix W3C capabilities by merging them with JSONWP caps [BaseDriver] The capabilities ["platformVersion","deviceName","appPackage","appActivity"] are not standard capabilities and should have an extension prefix [Appium] [Appium] ====================================================================== [Appium] DEPRECATION WARNING: [Appium] [Appium] The 'automationName' capability was not provided in the desired [Appium] capabilities for this Android session [Appium] [Appium] Setting 'automationName=UiAutomator2' by default and using the [Appium] UiAutomator2 Driver [Appium] [Appium] The next major version of Appium (2.x) will **require** the [Appium] 'automationName' capability to be set for all sessions on all [Appium] platforms [Appium] [Appium] In previous versions (Appium <= 1.13.x), the default was [Appium] 'automationName=UiAutomator1' [Appium] [Appium] If you wish to use that automation instead of UiAutomator2, please [Appium] add 'automationName=UiAutomator1' to your desired capabilities [Appium] [Appium] For more information about drivers, please visit [Appium] http://appium.io/docs/en/about-appium/intro/ and explore the [Appium] 'Drivers' menu [Appium] [Appium] ====================================================================== [Appium] [Appium] Appium v1.15.0 creating new AndroidUiautomator2Driver (v1.37.1) session [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided [BaseDriver] Creating session with W3C capabilities: { [BaseDriver] "alwaysMatch": { [BaseDriver] "platformName": "Android", [BaseDriver] "appium:platformVersion": "5.1.1", [BaseDriver] "appium:deviceName": "Android Emulator", [BaseDriver] "appium:appPackage": "com.android.calculator2", [BaseDriver] "appium:appActivity": ".Calculator" [BaseDriver] }, [BaseDriver] "firstMatch": [ [BaseDriver] {} [BaseDriver] ] [BaseDriver] } [BaseDriver] Session created with session id: 838e3971-499e-42b3-aacd-1ef1a14ff4be [UiAutomator2] Starting 'com.android.calculator2' directly on the device [ADB] Found 1 'build-tools' folders under 'E:\androidsdk\android-sdk-windows' (newest first): [ADB] E:/androidsdk/android-sdk-windows/build-tools/29.0.2 [ADB] Using 'adb.exe' from 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe' [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] Connected devices: [{"udid":"emulator-5554","state":"device"}] [AndroidDriver] Looking for a device with Android '5.1.1' [ADB] Setting device id to emulator-5554 [ADB] Getting device platform version [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 5.1.1 [AndroidDriver] Using device: emulator-5554 [ADB] Using 'adb.exe' from 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe' [ADB] Setting device id to emulator-5554 [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 22 [ADB] Device API level: 22 [AndroidDriver] No app sent in, not parsing package/activity [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings' [ADB] 'io.appium.settings' is installed [ADB] Getting package info for 'io.appium.settings' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings' [ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["E:\\androidsdk\\android-sdk-windows\\platform-tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\emulator\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\bin\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\build-tools\\29.0.2\\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'E:\androidsdk\android-sdk-windows'? [ADB] Using 'aapt.exe' from 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\aapt.exe' [ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.2' >= '2.14.2') [ADB] There is no need to install/upgrade 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' [ADB] Getting IDs of all 'io.appium.settings' processes [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?'' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pidof --help > /dev/null; echo $?'' [ADB] Using ps-based PID detection [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell ps' [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions. [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell settings put secure mock_location 1' [Logcat] Starting logcat capture [ADB] Getting install status for io.appium.uiautomator2.server [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server' [ADB] 'io.appium.uiautomator2.server' is installed [ADB] Getting package info for 'io.appium.uiautomator2.server' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server' [ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["E:\\androidsdk\\android-sdk-windows\\platform-tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\emulator\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\bin\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\build-tools\\29.0.2\\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'E:\androidsdk\android-sdk-windows'? [ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.3.0' >= '4.3.0') [UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled [ADB] Checking app cert for C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk [ADB] Using 'apksigner.bat' from 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\apksigner.bat' [ADB] Starting 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\apksigner.bat' with args '["verify","--print-certs","C:\\Users\\Administrator\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v4.3.0.apk"]' [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81 [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87 [ADB] [ADB] 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' is already signed. [ADB] Getting install status for io.appium.uiautomator2.server.test [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test' [ADB] 'io.appium.uiautomator2.server.test' is not installed [ADB] Checking app cert for C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk [ADB] Starting 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\apksigner.bat' with args '["verify","--print-certs","C:\\Users\\Administrator\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk"]' [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81 [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87 [ADB] [ADB] 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' is already signed. [UiAutomator2] Server packages are going to be (re)installed [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'ls -t -1 /data/local/tmp/appium_cache 2>&1 || echo _ERROR_'' [ADB] The current Android API does not support extended ls options. Defaulting to no-options call [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'ls /data/local/tmp/appium_cache 2>&1 || echo _ERROR_'' [ADB] The count of applications in the cache: 2 [ADB] The application at 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' is already cached to '/data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm install -r /data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' [UiAutomator2] Deleting UiAutomator2 session [UiAutomator2] Deleting UiAutomator2 server session [WD Proxy] Matched '/' to command name 'deleteSession' [UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.android.calculator2' [Logcat] Stopping logcat capture [ADB] Removing forwarded port socket connection: 8200 [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 forward --remove tcp\:8200' [UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command 'E:\\androidsdk\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s emulator-5554 forward --remove tcp\:8200' exited with code 1'; Stderr: 'adb.exe: error: listener 'tcp:8200' not found'; Code: '1'' [BaseDriver] Event 'newSessionStarted' logged at 1571708636226 (09:43:56 GMT+0800 (中国标准时间)) [W3C] Encountered internal error running command: Error executing adbExec. Original error: 'Command 'E:\\androidsdk\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s emulator-5554 shell pm install -r /data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'uiautomator2ServerInstallTimeout' capability [W3C] Error: Command 'E:\\androidsdk\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s emulator-5554 shell pm install -r /data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' timed out after 20000ms [W3C] at Timeout.setTimeout (C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:125:19) [W3C] at ontimeout (timers.js:427:11) [W3C] at tryOnTimeout (timers.js:289:5) [W3C] at listOnTimeout (timers.js:252:5) [W3C] at Timer.processTimers (timers.js:212:10) [HTTP] <-- POST /wd/hub/session 500 28715 ms - 1450 [HTTP] ```

Uiautomator android5.0 SE问题

通过 android apk封装adb shell uiautomator runtest命令 调用uiautomator运行测试 在android 4.4 机器上没有问题 5.0上面会报找不到jar包问题,要么就是什么都不显示也不运行。 注:不是root问题 是SE问题 哪位大神遇到过,求帮助,谢谢!!!

python利用adb操作android模拟器app,利用ADBKeyboard方案无效,求解决方案

python利用adb操作android模拟器app,利用ADBKeyboard方案无效,输出乱码 ``` os.system("adb shell am broadcast -a ADB_INPUT_TEXT --es msg '你好'") ```

Appium+Python爬虫无法启动APP

非计算机专业,初学python和appium,需要抓取小红书APP的数据,连接夜神模拟器,但是无法启动APP,一直报错找不到原因,下面放上appium工作日志希望各路大神可以帮帮忙。谢谢大家! ``` [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","deviceName":"127.0.0.1:62025","appPackage":"com.xingin.xhs","platformVersion":"5.1.1","appActivity":".activity.SplashActivity","noReset":true,"unicodeKeyboard":true},null,{"firstMatch":[{"platformName":"Android","appium:deviceName":"127.0.0.1:62025","appium:appPackage":"com.xingin.xhs","appium:platformVersion":"5.1.1","appium:appActivity":".activity.SplashActivity","appium:noReset":true,"appium:unicodeKeyboard":true}]}] [BaseDriver] Event 'newSessionRequested' logged at 1553679403156 (17:36:43 GMT+0800 (中国标准时间)) [Appium] DeprecationWarning: 'automationName' capability was not provided. Future versions of Appium will require 'automationName' capability to be set for Android sessions. [Appium] Setting automation to 'UiAutomator1'. [Appium] Creating new AndroidDriver (v4.8.0) session [Appium] Capabilities: [Appium] platformName: Android [Appium] deviceName: 127.0.0.1:62025 [Appium] appPackage: com.xingin.xhs [Appium] platformVersion: 5.1.1 [Appium] appActivity: .activity.SplashActivity [Appium] noReset: true [Appium] unicodeKeyboard: true [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"platformName":"Android","... were provided [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa... [BaseDriver] Session created with session id: 4aa3fc42-b895-499c-b714-aaaf47854f3a [AndroidDriver] Java version is: 1.8.0_201 [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.1.1' [ADB] Setting device id to 127.0.0.1:62001 [ADB] Getting device platform version [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 5.1.1 [AndroidDriver] Using device: 127.0.0.1:62001 [ADB] Setting device id to 127.0.0.1:62001 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 22 [ADB] Device API level: 22 [AndroidDriver] App file was not listed, instead we're going to run com.xingin.xhs directly on the device [AndroidDriver] Checking whether package is present on the device [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell pm list packages com.xingin.xhs' [AndroidDriver] Starting Android session [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 wait-for-device' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.settings' [ADB] 'io.appium.settings' is not installed [ADB] App 'C:\Users\zlp\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' is not installed [ADB] Installing 'C:\Users\zlp\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' [ADB] Skipping permissions grant option, since the current API level 22 does not support applications permissions customization [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 install C\:\\Users\\zlp\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\io.appium.settings\\apks\\settings_apk-debug.apk' [ADB] Install command stdout: pkg: /data/local/tmp/settings_apk-debug.apk [ADB] Success [ADB] Getting IDs of all 'io.appium.settings' processes [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell 'pgrep --help; echo $?'' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell 'pidof --help > /dev/null; echo $?'' [ADB] Using ps-based PID detection [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ps' [AndroidDriver] Granting android.permission.SET_ANIMATION_SCALE, CHANGE_CONFIGURATION, ACCESS_FINE_LOCATION by pm grant [ADB] Granting permissions ["android.permission.SET_ANIMATION_SCALE","android.permission.CHANGE_CONFIGURATION","android.permission.ACCESS_FINE_LOCATION"] to 'io.appium.settings' [ADB] Got the following command chunks to execute: [["pm","grant","io.appium.settings","android.permission.SET_ANIMATION_SCALE",";","pm","grant","io.appium.settings","android.permission.CHANGE_CONFIGURATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_FINE_LOCATION",";"]] [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell pm grant io.appium.settings android.permission.SET_ANIMATION_SCALE \; pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION \; pm grant io.appium.settings android.permission.ACCESS_FINE_LOCATION \;' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell settings put secure mock_location 1' [Logcat] Starting logcat capture [AndroidDriver] Enabling Unicode keyboard support [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell settings get secure default_input_method' [AndroidDriver] Unsetting previous IME com.android.inputservice/.InputService [AndroidDriver] Setting IME to 'io.appium.settings/.UnicodeIME' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ime enable io.appium.settings/.UnicodeIME' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ime set io.appium.settings/.UnicodeIME' [ADB] Getting device platform version [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 5.1.1 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell wm size' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.product.model' [ADB] Current device property 'ro.product.model': MI 6 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.product.manufacturer' [ADB] Current device property 'ro.product.manufacturer': Xiaomi [AndroidDriver] No app sent in, not parsing package/activity [AndroidDriver] No app capability. Assuming it is already on the device [AndroidBootstrap] Watching for bootstrap disconnect [ADB] Forwarding system: 4724 to device: 4724 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 forward tcp\:4724 tcp\:4724' [UiAutomator] Starting UiAutomator [UiAutomator] Moving to state 'starting' [UiAutomator] Parsing uiautomator jar [UiAutomator] Found jar name: 'AppiumBootstrap.jar' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 push C\:\\Users\\zlp\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-driver\\bootstrap\\bin\\AppiumBootstrap.jar /data/local/tmp/' [ADB] Attempting to kill all uiautomator processes [ADB] Getting IDs of all 'uiautomator' processes [ADB] Using ps-based PID detection [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ps' [ADB] No 'uiautomator' process has been found [UiAutomator] Starting UIAutomator [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","127.0.0.1:62001","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.xingin.xhs","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false] [UiAutomator] Moving to state 'online' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json... [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers. [AndroidBootstrap] Android bootstrap socket is now connected [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys window' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [AndroidDriver] Screen already unlocked, doing nothing [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n com.xingin.xhs/.activity.SplashActivity -S' [AndroidDriver] Shutting down Android driver [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop com.xingin.xhs' [BaseDriver] Event 'newSessionStarted' logged at 1553679571306 (17:39:31 GMT+0800 (中国标准时间)) [W3C] Encountered internal error running command: Error: Cannot start the 'com.xingin.xhs' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'D\:\\android-sdk\\sdk\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools\\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n com.xingin.xhs/.activity.SplashActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability [W3C] at ADB.apkUtilsMethods.startApp (C:\Users\zlp\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:144:11) [HTTP] <-- POST /wd/hub/session 500 168162 ms - 1794 [HTTP] ```

appium 测试无法打开 app,请各位大神帮忙

初学appium,使用python写测试脚本,现在可以安装上app,之后无法自动启动app。 这是我的脚本: #coding=utf-8 from appium import webdriver from lib2to3.pgen2.driver import Driver from lib2to3.tests.support import driver import os import time PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(file),p)) global driver desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '4.4.2' desired_caps['deviceName'] = 'b91b9b66' #desired_caps['appPackage'] = 'com.zhengyuan.watch' #desired_caps['appActivity'] = 'com.zhengyuan.watch.logic.launch.AppStart' desired_caps['app'] = PATH('D:\android\app\rtring_c_zhengyuan.apk') driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) time.sleep(5) driver.swipe(600,660,10,660,1000) time.sleep(1) driver.swipe(600,660,10,660,1000) time.sleep(1) log: info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"b91b9b66","app":"D:\android\app\rtring_c_zhengyuan.apk","platformName":"Android"}} info: Client User-Agent string: Python-urllib/2.7 info: [debug] No appActivity desired capability or server param. Parsing from apk. info: [debug] No appPackage desired capability or server param. Parsing from apk. info: [debug] Using local app from desired caps: D:\android\app\rtring_c_zhengyuan.apk info: [debug] Creating new appium session 7ab051a1-8c95-4b9a-a998-f1748ed52d47 info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.7.0_79 info: [debug] Checking whether adb is present info: [debug] Using adb from D:\android\sdk\platform-tools\adb.exe info: [debug] Parsing package and activity from app manifest info: [debug] Checking whether aapt is present info: [debug] Using aapt from D:\android\sdk\build-tools\android-4.4W\aapt.exe info: [debug] Extracting package and launch activity from manifest. info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\aapt.exe dump badging D:\android\app\rtring_c_zhengyuan.apk info: [debug] badging package: com.zhengyuan.watch info: [debug] badging act: com.zhengyuan.watch.logic.launch.AppStart info: [debug] Parsed package and activity are: com.zhengyuan.watch/com.zhengyuan.watch.logic.launch.AppStart info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Checking whether app is actually present info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe devices info: [debug] 1 device(s) connected info: Found device b91b9b66 info: [debug] Setting device id to b91b9b66 info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 wait-for-device info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 19 info: Device API level is: 19 info: [debug] Extracting strings for language: default info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop persist.sys.language" info: [debug] Current device persist.sys.language: zh info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\android\app\rtring_c_zhengyuan.apk" "C:\Users\admin\AppData\Local\Temp\com.zhengyuan.watch" zh info: [debug] Reading strings from converted strings.json info: [debug] Setting language to default info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "C:\Users\admin\AppData\Local\Temp\com.zhengyuan.watch\strings.json" /data/local/tmp info: [debug] Checking whether aapt is present info: [debug] Using aapt from D:\android\sdk\build-tools\android-4.4W\aapt.exe info: [debug] Retrieving process from manifest. info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\aapt.exe dump xmltree D:\android\app\rtring_c_zhengyuan.apk AndroidManifest.xml info: [debug] Set app process to: com.zhengyuan.watch info: [debug] Not uninstalling app since server not started with --full-reset info: [debug] Checking app cert for D:\android\app\rtring_c_zhengyuan.apk. info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\android\app\rtring_c_zhengyuan.apk info: [debug] App already signed. info: [debug] Zip-aligning D:\android\app\rtring_c_zhengyuan.apk info: [debug] Checking whether zipalign is present info: [debug] Using zipalign from D:\android\sdk\build-tools\android-4.4W\zipalign.exe info: [debug] Zip-aligning apk. info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\zipalign.exe -f 4 D:\android\app\rtring_c_zhengyuan.apk C:\Users\admin\AppData\Local\Temp\116210-428-1fgurq6\appium.tmp info: [debug] MD5 for app is 310a577ec209ceac8a6dee5086a1bf5d info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ls /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk" info: [debug] Getting install status for com.zhengyuan.watch info: [debug] Getting device API level info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 19 info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "pm list packages -3 com.zhengyuan.watch" info: [debug] App is installed info: Installing App info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "mkdir -p /data/local/tmp/" info: [debug] Removing any old apks info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ls /data/local/tmp/*.apk" info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell rm "/data/local/tmp/8f29ab35c86ad03708a23dfe9aaeeaa0.apk" info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "D:\android\app\rtring_c_zhengyuan.apk" /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk info: [debug] Uninstalling com.zhengyuan.watch info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "am force-stop com.zhengyuan.watch" info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 uninstall com.zhengyuan.watch info: [debug] App was uninstalled info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "pm install -r /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk" info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/ info: [debug] Pushing settings apk to device... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk" info: [debug] Pushing unlock helper app to device... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk" info: Starting App info: [debug] Attempting to kill all 'uiautomator' processes info: [debug] Getting all processes with 'uiautomator' info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ps 'uiautomator'" info: [debug] Attempting to kill process 31936 info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "kill 31936" info: [debug] Running bootstrap info: [debug] spawning: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.zhengyuan.watch -e disableAndroidWatchers false info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream= info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap: info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1 info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724 info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready info: [debug] [BOOTSTRAP] [debug] Loading json... error: Unhandled error: Error: getaddrinfo ENOENT at Object.exports.errnoException (util.js:746:11) at errnoException (dns.js:49:15) at GetAddrInfoReqWrap.onlookup as oncomplete context: [POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"b91b9b66","app":"D:\android\app\rtringc_zhengyuan.apk","platformName":"Android"}}] info: [debug] [BOOTSTRAP] [debug] json loading complete. info: [debug] [BOOTSTRAP] [debug] Registered crash watchers. info: <-- POST /wd/hub/session - - ms - - undefined 之后就停住了,请大家帮我看看是什么问题,纠结了好几天了,谢谢大家!

adb如何查看指定APP的日志呢?网上试了很多方法都不行!

adb如何查看指定APP的日志呢?网上试了很多方法都不行!有没有大佬帮忙看一下呢?各位

android-appium: A new session could not be created

detail log: org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c “C:\Users\sxie\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell “ps ‘uiautomator’”” ) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: ‘3.4.0’, revision: ‘unknown’, time: 'unknown’ System info: host: ‘WL00070299’, ip: ‘10.110.12.39’, os.name: ‘Windows 8.1’, os.arch: ‘x86’, os.version: ‘6.3’, java.version: '1.8.0_40’ Driver info: driver.version: 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:215) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167) at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:161) at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:76) at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:111) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637) 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:250) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:73) at com.sky.demo.ContactTest.setUp(ContactTest.java:44) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) ========================================== 直接在cmd中执行"C:\Windows\system32\cmd.exe /s /c "C:\Users\sxie\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'"" bad pid 'uiautomator'", 报错: bad pid 'uiautomator' =============================================================================== code: public class ContactTest { private AndroidDriver driver; @Before public void setUp() throws Exception { //设置apk的路径 File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot, "apps"); File app = new File(appDir, "ContactManager.apk"); //设置自动化相关参数 DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability("automationName","Appium"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("deviceName", "Pixel_XL_API_25");// Galaxy_Nexus_API_25 capabilities.setCapability("noReset", true); capabilities.setCapability("avdReadyTimeout", 300000); capabilities.setCapability("sessionOverride", true); //设置安卓系统版本 capabilities.setCapability("platformVersion", "7.1.1"); //设置apk路径 capabilities.setCapability("app", app.getAbsolutePath()); //设置app的主包名和主类名 capabilities.setCapability("appPackage", "com.example.android.contactmanager"); capabilities.setCapability("appActivity", ".ContactManager"); //初始化 driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS); } @Test public void addContact(){ WebElement el = driver.findElement(By.name("Add Contact")); el.click(); List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText"); textFieldsList.get(0).sendKeys("feimaoyuzhubaobao"); textFieldsList.get(2).sendKeys("forever together"); driver.swipe(100, 500, 100, 100, 2); driver.findElementByName("Save").click(); } @After public void tearDown() throws Exception { driver.quit(); } }

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

C++(数据结构与算法)78:---分而治之

一、分而治之的思想 分而治之方法与软件设计的模块化方法非常相似 分而治之通常不用于解决问题的小实例,而要解决一个问题的大实例。一般步骤为: ①把一个大实例分为两个或多个更小的实例 ②分别解决每个小实例 ③把这些小实例的解组合成原始大实例的解 二、实际应用之找出假币 问题描述 一个袋子有16个硬币,其中只有一个是假币,这个假币比其他的真币重量轻(其他所有真币的重量都是相同的)...

springboot+jwt实现token登陆权限认证

一 前言 此篇文章的内容也是学习不久,终于到周末有时间码一篇文章分享知识追寻者的粉丝们,学完本篇文章,读者将对token类的登陆认证流程有个全面的了解,可以动态搭建自己的登陆认证过程;对小项目而已是个轻量级的认证机制,符合开发需求;更多精彩原创内容关注公主号知识追寻者,读者的肯定,就是对作者的创作的最大支持; 二 jwt实现登陆认证流程 用户使用账号和面发出post请求 服务器接受到请求后使用私...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

win10暴力查看wifi密码

刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

早上躺尸,晚上干活:硅谷科技公司这么流行迟到?

硅谷科技公司上班时间OPEN早已不是什么新鲜事,早九晚五是常态,但有很多企业由于不打卡,员工们10点、11点才“姗姗来迟”的情况也屡见不鲜。 这种灵活的考勤制度为人羡慕,甚至近年来,国内某些互联网企业也纷纷效仿。不过,硅谷普遍弹性的上班制度是怎么由来的呢?这种“流行性迟到”真的有那么轻松、悠哉吗? 《动态规划专题班》 课程试听内容: 动态规划的解题要领 动态规划三大类 求最值/计数/可行性 常...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

在拼多多上班,是一种什么样的体验?我心态崩了呀!

之前有很多读者咨询我:武哥,在拼多多上班是一种什么样的体验?由于一直很忙,没抽出时间来和大家分享。上周末特地花点时间来写了一篇文章,跟大家分享一下拼多多的日常。 1. 倒时差的作息 可能很多小伙伴都听说了,拼多多加班很严重。这怎么说呢?作息上确实和其他公司有点区别,大家知道 996,那么自然也就能理解拼多多的“11 11 6”了。 所以当很多小伙伴早上出门时,他们是这样的: 我们是这样的: 当...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

立即提问
相关内容推荐