python--编写用例脚本

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()

posted @ 2016-06-16 17:18  susansu  阅读(945)  评论(0编辑  收藏  举报