Appium Automation Testing (3)-Control positioning & Chinese input

Source: Internet
Author: User
Tags appium

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
  1. #coding=utf-8
  2. Import time
  3. from appium import webdriver
  4. desired_caps ={}
  5. desired_caps[‘platformName‘]=‘Android‘
  6. desired_caps[‘platformVersion‘]=‘4.4.4‘
  7. desired_caps[‘deviceName‘]=‘Android Emulator‘
  8. desired_caps[‘appPackage‘]=‘com.XX.activity‘
  9. desired_caps[‘appActivity‘]=‘.XXSearchActivity‘
  10. desired_caps[‘unicodeKeyboard‘]=True
  11. desired_caps[‘resetKeyboard‘]=True
  12. driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘, desired_caps)
  13. driver.find_elements_by_name("搜索话题")
  14. driver.find_element_by_class_name("android.widget.EditText").send_keys(u"可爱")
  15. # driver.find_element_by_id(‘et_searchactivity_search‘).send_keys(u"可爱")
  16. driver.find_element_by_name("搜索").click()
  17. Time.sleep (5)//Pause on page for 5 seconds
  18. driver.quit()
                            



From for notes (Wiz)



List of attachments
    • Qq20150811175846.png

Appium Automation Testing (3)-Control positioning & Chinese input

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.