zoukankan      html  css  js  c++  java
  • IOS自动化环境搭建踩坑指南

    环境搭建

    准备一台mac电脑

    1.安装所需的依赖

    # 安装node
    brew install node
    
    # 查看npm版本
    npm -v
    
    # 安装Carthage
    brew install Carthage # 如果只是更新请输入 brew upgrade carthage
    
    # 长期替换(建议使用此项配置)  
    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles'>>   ~/.bash_profile   
    
    #执行.bash_profile脚本让配置即时生效
    source ~/.bash_profile   
    

    编译WebDriverAgent项目并在真机安装

    1.获取wda项目代码

    # appium分支wda(推荐)
    git clone https://github.com/appium/WebDriverAgent
    
    # facebook分支wda
    git clone https://github.com/facebook/WebDriverAgent
    

    2.编译wda并安装到ios测试机上

    • 个人编译:mac用最新版本的xcode去编译wda项目需要相关证书,推荐企业证书,请参考此文章https://blog.csdn.net/weixin_50271247/article/details/109226088
    • 开发编译(推荐):直接让开发把证书配置好,编译wda到你的ios测试机上,可以让开发协助你打一个wda的ipa文件,这样所有的ios手机都可以安装

    使用阿里开源的 tidevice

    tidevice端口转发

    • 安装pip3 install -U "tidevice[openssl]"
    • 验证tidevice version
    • 启动转发tidevice wdaproxy --port 8100

    ps:如果用Windows的化记得安装一个爱思助手or或者pp助手,否则会出现远程计算机积极拒绝

    元素定位

    1.使用weditor定位

    • 安装pip3 install weditor
    • 启动python3 -m weditor

    2.使用airtest定位

    • 下载airtest,启动了tidevice,在airtest的右下角点击连接即可(如果weditor有定位不到的情况下推荐airtest定位)

    3.使用appium定位

    UI操作库

    facebook-wda(推荐)

    appium

    ps:只要手机上安装了wda,后续即可离开mac电脑,windows亦可写测试代码

    本文为原创,如果转载请注明出处;
  • 相关阅读:
    socket-重叠模型(overlap)
    ssh 免密登陆
    安装google 框架
    为什么不同网段的ip 不能直接通信
    python中的import,reload,以及__import__
    C Runtime Library、C  Runtime
    SQLite3 C/C++ 开发接口简介
    mysql添加索引语句
    mysql 字段左右补0
    @Transactional注解的失效场景
  • 原文地址:https://www.cnblogs.com/ze-yan/p/15010065.html
Copyright © 2011-2022 走看看