from appium import webdriver
from time import sleep
desired_caps={}
desired_caps['platformName']='Android' #使用的移动平台iOS, Android, or FirefoxOS?
desired_caps['platformVersion']='4.4.2' #平台版本号
desired_caps['deviceName']='127.0.0.1:62001'
desired_caps['appPackage']='com.youdao.calculator'
desired_caps['appActivity']='com.youdao.calculator.activities.MainActivity'
#输入中文需要设置下面这两个 参数:
desired_caps['resetKeyboard']='True'
desired_caps['unicodeKeyboard']='True'
driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
sleep(10)
driver.find_element_by_id('com.ibox.calculators:id/digit8').click()
driver.find_element_by_id('com.ibox.calculators:id/digit7').click()
driver.find_element_by_id('com.ibox.calculators:id/plus').click()
driver.find_element_by_id('com.ibox.calculators:id/digit3').click()
driver.find_element_by_id('com.ibox.calculators:id/equal').click()
sleep(3)
driver.find_element_by_id('com.ibox.calculators:id/clear').click()
driver.quit()