美文网首页
Appium(二)Python demo

Appium(二)Python demo

作者: 臂力棒在想 | 来源:发表于2017-06-21 16:29 被阅读62次

Python版客户端类库:Appium-Python-Client

可以通过pip安装

pip install Appium-Python-Client

Demo

  1. 启动Appium服务
    GUI启动,不适用与持续集成。

  2. 命令行启动
    最简单的启动命令如下:

%APPIUM_HOME%\node %APPIUM_HOME%\node_modules\appium\bin\appium --address 127.0.0.1 --port 4723

tips:推荐统一配置如APPIUM_HOME=D:\env\Appium环境变量,这样在不同的测试人员的机器上都可以用统一命令执行

  1. 编写Python脚本
# coding=utf-8
from appium import webdriver
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.2'
desired_caps['deviceName'] = 'Android Emulator'
desired_caps['app'] = 'D:\\com.jianshu.apk'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

相关文章

网友评论

      本文标题:Appium(二)Python demo

      本文链接:https://www.haomeiwen.com/subject/ldfaqxtx.html