Appium + python 进行iOS设备的UI自动化测试遇到的问题

以前通过这套框架接入Android时问题还不是很多,很轻松就能成功,但是到了iOS这里就各种报错,需要安装的插件也比Android多了好多。以下是本次iOS端遇到的问题。

参考文档

  1. Appium + IOS 自动化环境搭建教程
  2. IOS+Appium 自动化测试环境搭建

问题与解决方案

设置端口转发之后,在浏览器打开http://127.0.0.1:8100/inspector无法启动,返回的错误信息如下

"Unhandled endpoint: \/inspector -- http:\/\/127.0.0.1:8100\/ with parameters {\n    wildcards =     (\n        inspector\n    );\n}

这个是因为最新版本的appium已经将内置的inspector独立了出去,所以需要单独安装inspector进行调试。


使用appium-inspector无法连接真机,报错如下

Failed to create session. An unknown server-side error occurred while processing the command. Original error: '14.6' does not exist in the list of simctl SDKs. Only the following Simulator SDK versions are available on your system: 16.1

Github-issues
如果要使用,必须设置连接的真实设备的udid。否则 Appium 将尝试匹配模拟器

查询udid方式:

  1. 打开XCode,Windows -> Devices and Simulators ,查看当前连接的iPhone的信息中,identifier就是udid。
  2. 需要在Mac上使用 libimobiledevice 进行查询,安装方法如下:brew install libimobiledevice --HEAD ,之后在命令行中执行 idevice_id -l 就可以看到当前连接设备的udid。

添加udid之后继续报错,如下

Failed to create session. An unknown server-side error occurred while processing the command. Original error: The port #8100 is occupied by an other process. You can either quit that process or select another free port.

资源链接

posted @ 2023-03-07 11:04  两小无猜  阅读(428)  评论(0编辑  收藏  举报