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
校验安卓环境
- 启动
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
- Install from GitHub.
git clone git@github.com:appium/python-client.git
cd python-client
python setup.py install
7). 测试代码
# coding=utf-8
# Android environment
# 导入单元测试
import unittest
# 导入驱动
from appium import webdriverif __name__ == '__main__':desired_caps = {}# 平台名称desired_caps['platformName'] = 'Android'# 平台版本desired_caps['platformVersion'] = '10.0'# 设备名称: adb devicesdesired_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