Appium + Android + Mac 自动化测试环境搭建

1). JDK
2). Python
brew install python3
3). Andriod SDK
4). Node.js
5). Appium
  • 安装包安装
  • 命令行安装 npm install -g appium
  • 安装appium-doctor验证appium 环境
npm install -g appium-doctor

使用appium-doctor --ios校验ios环境,使用appium-doctor --android校验安卓环境

效果图.png
  • 启动
appium
6). Appium-Python-Client
  • Install from PyPi, as ‘Appium-Python-Client’.
pip install Appium-Python-Client
  • Install source from PyPi, as ‘Appium-Python-Client’. Download and unarchive Appium-Python-Client-0.2.tar.gz, then run
tar -xvf Appium-Python-Client-X.X.tar.gz
cd Appium-Python-Client-X.X
python setup.py install
  1. Install from GitHub.
git clone [email protected]:appium/python-client.git
cd python-client
python setup.py install
7). 测试代码
# coding=utf-8
# Android environment
# 导入单元测试
import unittest
# 导入驱动
from appium import webdriver

if __name__ == '__main__':
    desired_caps = {}
    # 平台名称
    desired_caps['platformName'] = 'Android'
    # 平台版本
    desired_caps['platformVersion'] = '10.0'
    # 设备名称: adb devices
    desired_caps['deviceName'] = '192.168.56.101:5555'
    # 路径, 绝对路径
    desired_caps['app'] = 'xxx.apk'
    # 启动
    self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
  • 运行python test.py

你可能感兴趣的:(Appium + Android + Mac 自动化测试环境搭建)