Mac-appium iOS真机测试

本文详细介绍如何在iOS系统上安装Appium并配置所需的环境,包括安装依赖库、解决安装过程中遇到的问题、检查iOS相关配置及更新WebDriverAgent等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、安装依赖库

brew install libimobiledevice --HEAD


npm install -g ios-deploy



注:如果没有安装 libimobiledevice,会导致Appium无法连接到iOS的设备,所以必须要安装,如果要在iOS10+的系统上使用appium,则需要安装ios-deploy


安装出现问题

DEEPbing:~ ewrwrw$ npm install -g ios-deploy

> ios-deploy@1.9.2 preinstall /usr/local/lib/node_modules/ios-deploy

> ./src/scripts/check_reqs.js && xcodebuild

stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! ios-deploy@1.9.2 preinstall: `./src/scripts/check_reqs.js && xcodebuild`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the ios-deploy@1.9.2 preinstall script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/xiaoyezi/.npm/_logs/2018-05-14T12_32_53_678Z-debug.log

解决:原因xcode升级,文件默认路径改变:

运行:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

在执行:sudo npm install -g ios-deploy --unsafe-perm=true


2、如果已安装appium-doctor忽略

npm install appium-doctor -g


3、
安装后执行

appium-doctor --ios


指令,可以查看与iOS相关配置是否完整,下图是全部配置都成功,如果有那一项是打叉的,则进行安装就可以了

例如:

brew install carthage

4、更新Appium中的WebDriverAgent

WebDriverAgent下载最新版本的WebDriverAgent进入下载后的 WebDriverAgent文件执行 命令
$ cd /Users/XXXX/git/WebDriverAgent
$ mkdir -p Resources/WebDriverAgent.bundle$ sh ./Scripts/bootstrap.sh

直接用Xcode打开 WebDriverAgent.xcodepro文件配置 WebDriverAgentLibWebDriverAgentRunner的证书

添加team

如果是免费版的个人证书,还需要修改下WebDriverAgent的BundleID,随便加点后缀,只要不跟其他人的重名就好 (注:一定设置好这个,有开发者证书就不需要了)

OK配置完成,运行


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值