zoukankan      html  css  js  c++  java
  • Appium Mac 环境安装

    Mac Appium-Desktop环境安装

    Step1. 前置环境安装

    • Node.js NPM 最新版本
      安装最新版本npm:npm install -g npm@latest
      用于构建inspector,和一些依赖库

    • CNPM: sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
      用于替代npm,npm下载太慢了

    • IOS-Deloy 依赖库:sudo cnpm install -g ios-deploy
      用于Xcode检测连接真机

    • Brew: /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
      用于安装另外两个依赖库,brew也是一个包管理工具

    • Libimobiledevice 依赖库:brew install --Head libimobiledevice

    • Carthage依赖库: brew install Carthage

    • appium-doctor :npm install -g appium-doctor
      用于检测appium的环境是否安装齐全appium-doctor --ios如果都是绿色并提示everything is OK说明appium环境已经安装成功了

    1. Xcode12.2

      Xcode历史版本下载:Here
      Command line tool与Xcode版本相同,先安装Command line tool后Xcode

    2. Appium-Desktop 1.18.3
      有条件升级最新版本

    Step2. 配置WebdriverAgent

    1. 获取WebdriverAgent项目

    1. 推荐使用新版本appium自带的Webdriveragent项目,路径为:
      /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent

    2. 下载facebook在git中的Webdriveragent项目,地址:
      https://github.com/facebookarchive/WebDriverAgent
      这个版本支持inspector接口,但是facebook在2018年之后不维护了
      不支持1.18.3版本的Appium【具体支持到哪个版本不清楚】

    2. 安装webdriveragent依赖

    执行:./Scripts/bootstrap.sh
    这里环境如果没有配置好,后面webdriverAgent运行测试的时候可能会报缺少文件等错误

    3. 配置WebdriverAgent

    配置webdriver的主要作用是给手机签名,官方教程:Here

    大概流程:

    1. 打开WebDriverAgent.xcodeproj项目文件
      如果需要切换Xcode版本:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer(xcode路径)
      查看当前Xcode版本:xcode-select -print-path

    2. 配置WebDriverAgentLib

      • 勾选自动签名
      • 选择Team,账号最好是开发者账号
      • 修改Bundle Identifier字段
    3. 配置WebDriverAgentRunner文件

      • 勾选自动签名
      • 选择Team,账号最好是开发者账号
      • 修改Bundle Identifier字段
    4. 运行WebdriverAgent项目
      选择WebDriverAgentRunner项目,设置选择Iphone,运行项目command+U
      第一次运行会报手机没有被信任的错误,设置-》通用-》设备管理 将应用信任之后重新运行程序

    5. 检测WebDriverAgentRunner是否运行成功
      运行成功后Output会输出结果,并且给出Url地址:
      ServerURLHere->http://xx.xx.xx.xx:8100
      如果访问不到,可以使用命令iproxy 8100 8100对手机8100端口进行转发
      查看端口命令:lsof -i:8100
      关闭端口命令:kill -9 8100
      在电脑端访问http://127.0.0.1:8100/status应该能够获得手机返回字符串

    {
      "value" : {
        "message" : "WebDriverAgent is ready to accept commands",
        "state" : "success",
        "os" : {
          "testmanagerdVersion" : 28,
          "name" : "iOS",
          "sdkVersion" : "14.2",
          "version" : "14.0"
        },
        "ios" : {
          "ip" : "172.16.16.85"
        },
        "ready" : true,
        "build" : {
          "time" : "Dec 11 2020 10:53:48",
          "productBundleIdentifier" : "com.facebook.WebDriverAgentRunner"
        }
      },
      "sessionId" : null
    }
    

    Appium运行

    在进行appium运行之前要确保WebdriverAgent项目在Xcode上已经运行成功
    并且成功获取到返回字符串,不然appium运行时会报build失败的错误
    配置信息如下:
    {
    "deviceName": "iPhone_x",
    "platformVersion": "14.0",
    "platformName": "IOS",
    "udid": "90b7f96a097651356f462c91fb10e590c240f33a",
    "bundleId": "com.cntaiping.portalQingyunTest",
    "automationName": "XCUITest",
    "noReset": true
    }

    遇到的错误

    Original error: Could not determine Xcode version: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.

    修改了info.plist文件,自己修改回来,不然Xcode可能也会访问不到手机

    Xcode 9.4.1 has a maximum SDK version of 11.4. It does not support iOS version 12.1.4

    当前xCodo10.1版本最高支持到IOS11.4

    dyld_shared_cache_extract_dylibs failed

    Xcode版本低了, 支持不了当前的IOS版本,升级Xcode版本

    XCodebuild failed with code '70' ·

    70,65,235错误都是webdriveragent没有配置好的原因。
    从git/facebook上面下载的webdriveragent项目文件配置一直出错,用appium-desktop自己的就成功了

  • 相关阅读:
    使用存储过程查询并按每页10条记录分页显示图书借阅纪录
    两个div并排 左边div宽固定 右边自适应
    java比较时间及时间的转换
    java使用commons.io的FileUtils进行文件拷贝
    实现image宽度100%,高度与宽度一致
    vue请求前的loading动画效果
    vue项目加载前空白的动画过渡效果
    element-ui和semantic-ui冲突的解决方法--局部引入semantic-ui的css
    vue使用formdata上传多个图片,springboot以文件数组的形式接受
    快速创建vuepress项目(使用vuepress写文档)
  • 原文地址:https://www.cnblogs.com/tangpeng97/p/13847027.html
Copyright © 2011-2022 走看看