from appium import webdriver
import time
desired_caps = {}
desired_caps[‘platformName‘] = ‘Android‘
desired_caps[‘platformVersion‘] = ‘4.4.2‘
desired_caps[‘deviceName‘] = ‘test1‘
desired_caps[‘appPackage‘] = ‘com.xxxxx‘
desired_caps[‘appActivity‘] = ‘.xxxx‘
driver = webdriver.Remote(‘http://localhost/wd/hub‘, desired_caps)
#在输入框中输入值
driver.find_element_by_class_name("xxx.EditText").send_keys("xxx")
#点击事件
driver.find_element_by_id("xxx").click()
# login
driver.find_element_by_id("xxx").click()
#等待2秒
time.sleep(2)
# massage
driver.find_element_by_id("xxx").click()
driver.find_element_by_id("xxx").click()
#退出app
driver.quit()
时间: 2024-10-07 01:05:41