美文网首页iOS自动化测试
Mac下iOS+appium+python--环境配置

Mac下iOS+appium+python--环境配置

作者: Minerest | 来源:发表于2018-08-03 09:43 被阅读0次

    总结了广大网友的经验,希望给其他第一次搭建环境的同学带来帮助。

    硬件:Mac OS(10.13),Xcode 9.2(支持iOS11.2),iPhone (11.2.6)【Xcode的版本要与真机能够兼容】

    注:环境的安装最好电脑上挂个VPN

    1、Mac一般都自带python,如果没有,自行百度找一下Mac的python的安装

    2、安装Homebrew

    /usr/bin/ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    3、安装 libimobiledevice

    brew install libimobiledevice --HEAD

    4、安装carthage

    brew install carthage

    5、安装node(目的是安装npm)按照官方的地址https://nodejs.org/en/download/。 下载.pkg文件安装

    6、安装cnpm(由于某种原因,直接用npm下载安装会有好多网络问题,安装淘宝的cnpm要比npm好用) https://npm.taobao.org/

    npminstall-gcnpm--registry=https://registry.npm.taobao.org

    7、安装iOS-deploy

    cnpm install -g ios-deploy

    若出现超时的问题:

    //设置镜像源npm configsetregistry https://registry.npm.taobao.org --global//配置镜像列表npm configlist//执行安装指令npm install -g ios-deploy

    8、安装xcpretty

    gem install xcpretty

    9、安装appium ,可直接下载dmg或者desktop的版本。

    也可直接  cnpm install -g appium

    10、安装appium doctor

    npm install -g appium-doctor

    11、安装appium-xcuitest-driver依赖

    #如果已经安装,请先卸载

    #npm uninstall appium-xcuitest-driver

    npm install appium-xcuitest-driver

    12、配置WebDriverAgent[此步骤容易出错]

    ```

    cd~

    git   clonehttps://github.com/facebook/WebDriverAgent.git(可直接将文件夹下载到本地)

    cd   WebDriverAgent

    mkdir -p Resources/WebDriverAgent.bundle

    sh   ./Scripts/bootstrap.sh

    ```

    下面步骤的意思是将下载的包文件链接到driver中去

    cd   /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/

    rm   –rf WebDriverAgent(移除自带的,当然如果没有安装自带的就不用执行这个指令)

    ln -s ~/WebDriverAgent WebDriverAgent (其中~/WebDriverAgent是源地址,后面的是目标地址,也就是把你clone的项目链接到 driver 里面)

    13、编译WebDriverAgent

    (1)先进入目录文件,finder--前往文件夹,粘贴上webdriveragent的路径。

    (2)双击打开WebDriverAgent.xcodeproj项目,此处Mac上需要你的Xcode 账号,以及账号对应的证书。

    打开项目后,修改bundleID,与原来不同即可;signing中选择自动,再选择对应的开发者的账号和证书,修改完之后build,成功即可。

    配置证书 配置runner的证书 修改runner的bundleID

    (3)将Mac和真机在一个网段下(可连接一个ssid),在xcode中选择真机,按照之前的配置修改之后,快捷键command+U,可test工程,工程出现如下图所示即编译成功。【编译的过程保持手机不能锁屏】

    编译WebDriverAgent

    (4)检验ServerURLhere--在浏览器中输入地址http://XXXX:8100/status,出现字符串则说明成功。

    若未出现字符串,自检方法如下:

    【1】在host文件中加上172.0.0.0 localhost;

    【2】若xcode-test后出现的端口不是8100,修改方式如下

    修改端口号

    【3】手机和Mac在同一个网络

    (5)最后我们自检一下

    执行:Appium-doctor --ios,出现如下图所示即环境配置完成了

    配置完成

    文章中参考文献如下:

    MAC下搭建 appium+ios+python 自动化测试环境(一) - 简书

    在 MAC 上搭建 appium1.6.3 过程 · TesterHome

    相关文章

      网友评论

        本文标题:Mac下iOS+appium+python--环境配置

        本文链接:https://www.haomeiwen.com/subject/vnusvftx.html