Appium API (Common)

Source: Internet
Author: User
Tags appium

Lock

Lock screen

# Pythondriver.lock (5)
Put apps in the background

Put the current application in the background

# Pythondriver.background_app (5)

Pick up the keyboard

Pick up the keyboard

# Pythondriver.hide_keyboard ()

Start Activity

Open an activity in the current app or launch a new app and open an activity. can only be used on Android

# pythondriver.start_activity (' com.example.android.apis'). Foo')

Open the Notification bar (notifications)

Open the drop-down notification bar to use only on Android

# pythondriver.open_notifications ()

is already installed

Check if the app is already installed

# pythondriver.is_app_installed (' Com.example.android.apis')

Install the App

Install the application to the device

# Pythondriver.install_app (' path/to/my.apk')

Delete an app

Remove an app from your device

# Pythondriver.remove_app (' Com.example.android.apis')

Shaking (Shake)

Simulate device shaking

# Pythondriver.shake ()

Close the app

Close the app

# Pythondriver.close_app ();

Start (Launch)

Start the session (sessions) based on the service keyword (desired capabilities). Please note that this must be done autoLaunch=false when the keyword is set. This is not used to start the specified app/activities ———— you can use to start_activity do this ———— this is used to proceed with the autoLaunch=false initialization (Launch) process using the keyword.

# Pythondriver.launch_app ()

Reset (reset)

Application reset (equivalent to unloading load application)

# Pythondriver.reset ()

Available contexts (context)

List all the available contexts

Translation notes: The context can be understood as a window that can be accessed. For example, for native apps, the available context and default context are NATIVE_APP . See automated testing of hybrid applications for more details

# pythondriver.contexts

Current contexts (context)

List the current context

# Pythondriver.current_context

Switch to the default context (contextual)

To switch the context to the default context

# Pythondriver.switch_to.context (None)

Applied Strings (App Strings)

Get the applied string

# pythondriver.app_strings

Keystroke events (key event)

Send a key event to the device

# pythondriver.keyevent (176)

Current Activity

Gets the current activity. Can only be used on Android

# pythondriver.current_activity

Touch Action (touchaction)/multi-Touch Action (multitouchaction)

The interface that generates the touch action. This part of the document will soon be supplemented with more content to come in.

= Touchaction (Driver) action.press (elementx=y=ten). Release (). Perform ()

Slide (Swipe)

Simulate user swipe

# pythondriver.swipe (start=starty=endx=Endy=duration =800)

Pinch (Pinch)

Pinch the screen (double fingers move inward to narrow the screen)

# Pythondriver.pinch (element=el)

Zoom in (zoom)

Magnification screen (two fingers moving outward to enlarge the screen)

# pythondriver.zoom (element=el)

Swipe to (Scroll to)

Slide to an element.

# Pythontodo:python

Pulling files (pull file)

Pull the file out of the device

# pythondriver.pull_file (' library/addressbook/addressbook.sqlitedb')

Push files (push file)

Push files to the device

"Some data for the file"/data/local/tmp/file.txt"driver.push_file (Path, Data.encode (  ' base64'))

Set up

From here you can get/set the Appium server settings. If you want to know how it works and what settings it supports, check out the documentation on settings

= Driver.get_settings () driver.update_settings ({"somesetting": true}) 

Appium API (Common)

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.