当前位置: 代码迷 >> 综合 >> Appium + Android + Mac 自动化测试环境搭建
  详细解决方案

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

热度:70   发布时间:2023-09-11 03:07:54.0
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 + Android + Mac 自动化测试环境搭建
效果图.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 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
  相关解决方案