1.什么是Appium-Python-Client?
它是一个开发包,基于Python的,用于Appium。开发包中包含了Selenium 3.0 draft和Mobile Json Wire Protocol draft中的功能(API),用于移动端自动化测试。
2.如何安装和使用?
1)安装:
pip install Appium-Python-Client
2)使用:
- 请使用Appium中的Web Driver,而不要使用Selenium中的Web Driver。因为Appium中的Web Driver是Selenium中的Web Driver的拓展,作为一个新功能,对外界体现。
- 开发包中的Remote(),find_element-xxx()等方法均来自于这个开发包。
# Android environment
from appium import webdriver
desired_caps = dict(
platformName='Android',
platformVersion='10',
automationName='uiautomator2',
deviceName='Android Emulator',
app=PATH('../../../apps/selendroid-test-app.apk')
)
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
el = self.driver.find_element_by_accessibility_id('item')
el.click()
# iOS environment
from appium import webdriver
desired_caps = dict(
platformName='iOS',
platformVersion='13.4',
automationName='xcuitest',
deviceName='iPhone Simulator',
app=PATH('../../apps/UICatalog.app.zip')
)
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
el = self.driver.find_element_by_accessibility_id('item')
el.click()