目录
0x01 踩坑一 failed to start daemon
0x03 踩坑三 Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user
0x07 踩坑七 ImportError: cannot import name 'InvalidArgumentException'
0x08 踩坑八 WebDriverException: Message: The URL '/wd/hub//session' did not map to a valid resource
0x10 踩坑十 http://dl-ssl.google.com/android上不去解决方案
0x01 踩坑一 failed to start daemon
原因:daemon使用的端口被其他进程占用
Microsoft Windows [版本 10.0.17134.829]
(c) 2018 Microsoft Corporation。保留所有权利。
C:\Users\lenovo>adb
Android Debug Bridge version 1.0.41
Version 29.0.1-5644136
Installed as C:\Users\lenovo\AppData\Local\Android\android-sdk\platform-tools\adb.exe
C:\Users\lenovo>adb devices
adb server version (31) doesn't match this client (41); killing...
could not read ok from ADB Server
* failed to start daemon
adb.exe: failed to check server version: cannot connect to daemon
C:\Users\lenovo>netstat -aon|findstr "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 5312
TCP 127.0.0.1:5037 127.0.0.1:55443 ESTABLISHED 5312
TCP 127.0.0.1:5037 127.0.0.1:55792 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:55837 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:55852 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:55857 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:55873 TIME_WAIT 0
#省略
C:\Users\lenovo>tasklist|findstr "5312"
LdsMobileLink.exe 5312 Console 1 16,320 K
#在任务管理器中kill掉该进程
C:\Users\lenovo>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
******** device
0x02 踩坑二 SessionNotCreatedException: Message: A new session could not be created. (Original error: Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.)
原因:同时开启了多个
0x03 踩坑三 Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user
原因:
0x04 踩坑四 r: Failed to start an Appium session, err was: Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "C:\Users\lenovo\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 4f655297 shell "ps 'uiautomator'""
原因:
下载最新的appium-desktop或者参照上图方法
0x06 踩坑六 如何修改chromeoptions
C:\Users\lenovo>adb shell
oxygen:/ $ dumpsys activity top | grep ACTIVITY
ACTIVITY com.tencent.mm/.plugin.appbrand.ui.AppBrandUI 4492c5e pid=16051
oxygen:/ $ ps 16051
USER PID PPID VSIZE RSS WCHAN PC NAME
u0_a133 16051 800 2403720 227056 SyS_epoll_ 0000000000 S com.tencent.mm:appbrand0
oxygen:/ $
com.tencent.mm:appbrand0即为chromeoptions
'chromeOptions': {'androidProcess': 'com.tencent.mm:appbrand0'}
0x07 踩坑七 ImportError: cannot import name 'InvalidArgumentException'
原因:selenium.common.exceptions.py中未定义InvalidArgumentException类
在C:\anaconda\Lib\site-packages\selenium\common修改excptions.py
参考自:执行appium程序时遇到如下报错,ImportError: cannot import name 'InvalidArgumentException'
0x08 踩坑八 WebDriverException: Message: The URL '/wd/hub//session' did not map to a valid resource
参考自:Appium 1.9 版本 BUG:使用 get_window_size () 方法报错 · TesterHome
0x09 踩坑九 KeyError: 'status'
未解决
参考自:Appium遇到异常处理