1、当appium-desktop连接simulator模拟器或真机连接时报错:error: Could not determine Xcode version:Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.
解决方法来自stackoverflow(https://stackoverflow.com/questions/32724616/appium-error-could-not-get-xcode-version)
产生原因:不知道为什么,从应用商店下载的xcode的默认安装地址不是Application文件夹,所以appium拿不到path路径;
解决方法:
1.打开终端,重置:
|
2.连接:
|
3.重启appium,并成功连接;
2、在启动inspector后,包也装到simulator 可是应用已一启动就闪退
解决方法:3、osx模拟器搭建补充。 来自:http://www.cnblogs.com/llining/p/5040290.html
产生原因:这个问题是因为iOS 的不跨平台,编译时必须指定运行在 arm 还是 x86 上。具体在打包时的区别是使用的 sdk 不同。
3、当setValue或者send_keys报错:Original error: Error Domain=com.facebook.WebDriverAgent Code=1 "Keyboard is not present" UserInfo={NSLocalizedDescription=Keyboard is not present}
参考链接:https://www.jianshu.com/p/077f0662046c
解决方法:在键盘上用快捷键 command+⬆️+k
产生原因:mac 跑模拟器的时候,当定位到了输入框,但是无法输入内容,会报如上到错误,这是由于模拟器的键盘没有被弹出导致的
4、运行runner.py报错:urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x109c28908>: Failed to establish a new connection: [Errno 61] Connection refused'))
原因:没有打开appium-desktop
解决方法:打开appium-desktop
5、selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
现有的抓取元素的方法公用的是谓词抓取;
所以可能在页面还没有刷新时就会进行元素抓取,然后就会报找不到元素;
解决方法:在service层或elemnet层就对其进行sleep
目前我在public类的init方法里加了一个隐形等待,应该不会出现这个问题了;
6、Error Domain=com.facebook.WebDriverAgent Code=1 "The element '"返回" Button' is not visible on the screen and thus is not interactable"
未找到元素,拿appium-desktop的session查找看看是不是找不到
sleep大法好
7、小技巧
1: 如果app已经安装了,在不想安装app的情况下, 可通过dos窗口,通过启动appium带上 --no-reset 即可避免执行用例的时候再次安装app
2: appium默认启动一个应用的session过期时间是60秒到时间会自动停了刚启动的应用 appium --command-timeout 600 时间变成600秒了
8、App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name.
原因:app路径使用了相对路径
解决方法:appium中被测试的app必须是绝对路径;