reference-Control positioningHttp://www.2cto.com/kf/201410/340345.htmlAppium InterfaceHttp://appium.io/slate/en/master/?python#about-appium
control positioning is the process of accurately describing a control's characteristics and telling the machine. the control's characteristics are the properties of the control, which can be obtained through the uiautomatorviewer in the previous lecture . Here's how:
1. Through ResourceID Get Driver . find_element_by_id ( "Com.android.contacts:id/menu_add_contact" ). Click ()
2. By name : Findelementbyname ("name") 3, Findelementbyclassname ("classname") 4, Findelementbyaccessibilityid () equivalent to contentdescription on Android
Chinese Input Method: garbled & input Chinese error resolution
#coding=utf-8
- Import time
from appium import webdriver
desired_caps ={}
desired_caps[‘platformName‘]=‘Android‘
desired_caps[‘platformVersion‘]=‘4.4.4‘
desired_caps[‘deviceName‘]=‘Android Emulator‘
desired_caps[‘appPackage‘]=‘com.XX.activity‘
desired_caps[‘appActivity‘]=‘.XXSearchActivity‘
desired_caps[‘unicodeKeyboard‘]=True
desired_caps[‘resetKeyboard‘]=True
driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘, desired_caps)
driver.find_elements_by_name("搜索话题")
driver.find_element_by_class_name("android.widget.EditText").send_keys(u"可爱")
# driver.find_element_by_id(‘et_searchactivity_search‘).send_keys(u"可爱")
driver.find_element_by_name("搜索").click()
- Time.sleep (5)//Pause on page for 5 seconds
driver.quit()
From for notes (Wiz)
List of attachments
Appium Automation Testing (3)-Control positioning & Chinese input