Android自動化測試腳本
阿新 • • 發佈:2018-06-28
keyboard 使用 red ref 4.4.2 for 自動化測試 from cli
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()
Android自動化測試腳本