Appnium Positioning + operation mode (python)

Source: Internet
Author: User

1. Positioning:
A. Using Android uiautomator targeting:
Example: Driver.find_element_by_android_uiautomator (' New
Uiselector (). Description ("Animation")

B. Using accessibility ID to locate
Cases:
driver.find_element_by_accessibility_id (' Animation ')

C Use ID to locate:
Example: driver.find_element_by_id (' login ')

D using Xpath to locate
Example: Driver.find_element_by_xpath (XPath)

E: Use name to locate
Example: Driver.find_element_by_name (' Touch Paint ')

F: Using classname positioning
Example: Driver.find_elements_by_class_name (' ListView ')

2. Lock Screen Driver.lock (5)
3. Put the current application in the background go to Driver.background_app (5)
4. long hold the keyboard Driver.long_press_keycode (keycode)

5. Check if the app has driver.is_app_installed (' Com.example.android.apis ') installed

6. install the application to the device go to Driver.install_app (' path/to/my.apk ')

7. remove a driver.remove_app (' Com.example.android.apis ') from the device

8. Analog Equipment shaking driver.shake ()
9. Close the app Driver.close_app ()
Start Application Driver.launch_app ()
One by one. Apply reset driver.reset ()
12. List all the available contexts driver.contexts
13. List the current context Driver.current_context

14. Switch context to the default context Driver.switch_to.context (None)

15. driver.get_screenshot_as_file (filename)

16. Send a key event to the device Driver.keyevent (176)

17.Android only get Current activity driver.current_activity

19. Simulate user sliding driver.swipe (75, 500, 75, 0, 1000)

20. Double Finger zoom screen driver.pinch (Element=el) within 0% to 100%

21. Magnification screen at more than 100% magnification screen driver.zoom (Element=el)

22. Pull the file Driver.pull_file (' Library/addressbook/addressbook.sqlitedb ') from the device

23. Push the file to the device go to data = "Some data for the file"

Path = "/data/local/tmp/file.txt"

Driver.push_file (Path, Data.encode (' base64 '))

24. Hide Keyboard Driver.hide_keyboard ()
25. Install Appdriver.install_app (path)
26. Uninstall Appdriver.remove_app (app_id)
27. Print current Activitydriver.current_ ACTIVITY
28. Vibration Driver.shake ()
29. Open the notification bar (API 18 +) Driver.open_notifications ()
30. Get network Driver.network_connection
31. Get the phone screen resolution driver.get_window_size ()
32. Set screen resolution Driver.set_window_size (width,height)
33. Gets the current coordinate position driver.get_window_position ()
34. Switch location Service driver.toggle_location_services ()
35. Switch location Service Driver.toggle_location_services ()
36. Close close
37. Exit close all connections quit

38. Get the current page source Page_source
39. Get the current page page Current_url
4. Get the top left corner coordinates location of the element
41 Getting the element size
42. Whether the element is available is_enabled () returns True of False
43. Whether the element can be selected is_selected ()
44. Clear
45. Tap Click

46. Set longitude and latitude usage driver.set_location (latitude, longitude, height)
47. Returns the current Input method package name Active_ime_engine
48. Close the current input method Deactivate_ime_engine
49. Activate IME Activate_ime_engine
Usage
Driver.activate_ime_engine ("com.android.inputmethod.latin/
. Latinime ")

S_ime_active.

Check if the device has input method service activity. Returns True/False. Android usage
Print (Driver.is_ime_active ())

Appnium Positioning + operation mode (python)

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.