Appium API Interface

Source: Internet
Author: User

Appium API Interface

tags (space delimited): Appium Common API

1.contexts
Contexts (self)
Returns the context of the current session, using a control that can identify the H5 page;

  • Driver.contexts
  • 2.current_context
    Returns the current context for the current session:
    Usage: Driver.current_context
  • 3.context
    Returns the current context for the current session:
    Usage: Driver.context
  • Find_element_by_ios_uiautomation (self,uia_string)
    Find elements with iOS uiautomation
    iOS 9.3 or below is only supported for iOS legacy frame uiautomation, and is now largely rarely used
  • FIND_ELEMENT_BY_ACCESSIBILITY_ID (Self,id)
    Find elements by accessibility_id:
    Usage: driver.find_element_by_accessibility_id ()
  • Scroll ()
    From the starting element to the destination element
    Driver.scroll (EL,E2)
  • Drag_and_drop (Self,origin_el,destination_el)
    dragging element 1 to element 2
    Usage: Driver.drag_and_drop (E1,E2)
  • Tap
    Analog phone Tap the operation of the screen, you can enter up to five fingers, you can set the length of the hold time (in milliseconds)
    Driver.tap ([(100,20), (100,60) (100,100)],500)
  • Swipe ()
    Swipe from point A to point B and slide for milliseconds
    Driver.swipe (100,100,100,400)
  • Flick
    Press the a point to quickly slide the big B point
    Driver.flick (X1,y1,x2,y2)
  • Pinch
    Perform analog double zhi pinch on element (shrink operation)
    Driver.pinch (Element)
  • Zoom
    Perform a zoom operation on an element
    Driver.zoom (Element)
  • Reset
    Reset apps (similar to deleting app data)
    Driver.reset ()
  • Hide_keyboard ()
    Hide_kyeboard (Self,key_name=none,key=none,strategy=none)
    Hide keyboard, iOS use Key_name hide, Android does not use parameters
  • KeyEvent
    KeyEvent (Self,keycode,metas-tate=none)
    Send key code, Android only, key code can be found in the URL;
    Driver.keyevent (' 4 ')
  • Press_keycode
    Press_keycode (Self,keycode,metastate=none)
    Key codes only Android has
    Usage: DRIVER.P () Ress_keycode (' 4 ')
    Driver.keyevent (' 4 ') and Driver.press_keycode (' 4 ')
    The function realizes the same, all presses the return key;
  • Long_press_keycode
    Long_press_keycode (Self,keycode,metastate=none)
    Send a long-press key, (Long press a key)
  • Current_activity
    Get the current Activity
  • Wait_activity
    Wait_activity (self,activity,time-out,interval=1)
    Waits for the specified activity to appear until the time-out, interval is a scan interval of 1 seconds, that is, every few seconds to get the current activity returns TRUE or False
    Usage: driver.wait_activity ('. Activity.xxx ', 5,2)
  • Background_app
    How many seconds the app runs in the background
    Background_app (Self,seconds)
    Usage: Driver.background_app (5), placed backstage 5 seconds after running
  • Is_app_installed
    Is_app_installed (self,bundle_id)
    Check if background is installed, return value is true or False
  • Install_app (Self,app_path)
    Usage: Driver.install_app (app_path)
    Install App,app_path as the path to the installation package
  • Delete App
    Remove_app (self,app_id)
  • Launch_app (self):
    Start App,driver.launch_app ()
  • Close_app (self):
    Driver.close_app () Close app
  • Start_activity ()
    During the test, open any activity, if the valley activity belongs to another application, change the startup and activity of the application to be opened
    This is an Android method,
    Usage: driver.start_activity (app_package,app_activity)
  • Lock (Self.seconds)
    Lock screen for some time, iOS dedicated
  • Shake (self)
    Shake a phone
    Driver.shake ()
  • Open_notifications (self)
    Open the system notification bar, generally only support API18, above the Android system;
  • Network_connection (self)
    Return network type, value

There are many other follow-up people to check their own;

Appium API Interface

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.