Reproduced Appium's Java API

Source: Internet
Author: User
Tags appium

(reproduced in this article from: http://m.blog.csdn.net/blog/qhshiniba/38043631)

Appiumdriver

Getappstrings ()

The default system language corresponds to the data within the Strings.xml file.

Driver.getappstrings (String language)

Find a locale corresponding to a string file in Strings.xml data

sendkeyevent (int key)

Press a key, which key is determined by the key value, the key value is defined in the Androidkeycode class

sendkeyevent (int key, Integer metastate)

Press a key while pressing the additional key (Ctrl/alt/shift, etc.), which key is determined by the key value (defined in the Androidkeycode Class) and metastate (defined in the Androidkeymetastate Class).

CurrentActivity ()

Gets the current activity, such as (. Apidemos)

Isappinstalled (String Bundleid)

Determine if the application is installed according to Bundleid

Installapp (String AppPath)

Install App,apppath as your app's local path

Removeapp (String Bundleid)

Uninstalling App.bundleid on Android represents registration, and there is a dedicated Bundleid number in iOS.

Closeapp ()

To close the app, just press the home button to place the app in the background

Launchapp ()

Launch the App

Resetapp ()

First Closeapp and then in Launchapp.

Pushfile (String RemotePath, byte[] base64data)

Writes a character array to a file in a remote directory in 64-bit format. It can also be understood to push local files to the device.

Pullfile (String RemotePath)

Pull the files on your device to your local hard drive

Pullfolder (String RemotePath)

Pull the folder on your device to your local hard drive, and the remote file is usually a file under/data/local/tmp.

Setnetworkconnection (networkconnectionsetting connection)

Set the phone's network connection status, you can switch Bluetooth, WiFi, data traffic. The status of each network connection is set through the properties in networkconnectionsetting.

Getnetworkconnection ()

Get the status of the current network

Opennotifications ()

Open the Notification bar

Runappinbackground (int seconds)

Similar to Resetapp, the difference is that Resetapp is started immediately after shutting down, and this method is turned off after waiting for seconds seconds before starting.

Hidekeyboard ()

iOS hidden keyboard

Hidekeyboard (String strategy, String keyName)

Hide the keyboard and use it only on iOS.

Performtouchaction (touchaction touchaction)

Performs a touch action, which is encapsulated by the touchaction.

Performmultitouchaction (multitouchaction multiaction)

Performs multi-step touch action, multi-step operation by the Multitouchaction package.

Tap (int fingers, webelement element, int duration)

Click on the element control center to press duration*5, then release after milliseconds, so repeat fingers times.

Tap (int fingers, int x, int y, int duration)

Click (x, Y) to tap, duration*5 milliseconds to release, so repeat fingers times.

Swipe (int startx, int starty, int endx, int endy, int duration)

Slide from (startx,starty) to (Endx,endy), duration step, each step is 5 milliseconds.

Pinch (webelement el)

2 finger-operated controls, sliding from the diagonal to the center point.

pinch (int x, int y)

(x, Y) as the benchmark, calculated (x,y-100), (x,y+100) two points, and then 2 fingers hold the two points while sliding to (x, y)

Zoom (Webelement el)

The opposite of the Pinch (EL) action. Two fingers the center point of the control slowly slides to the right bottom after the left vertex of the control.

Zoom (int x, int y)

The opposite of pinch (x, y). Two fingers slide from (x, Y) point to (x,y-100) and (x,y+100).

Getnamedtextfield (String name)

Generally used in iOS. Gets the control object based on the accessibility ID.

Endtestcoverage (String intent, String path)

End detection of test coverage. The path to the. ec file is not used or understood.

Lockscreen (int seconds)

Lock screen After how many seconds to unlock (when using the hint has not implemented the method)

Shake ()

Simulate shaking the phone (not yet implemented)

ScrollTo (String text)

Scroll to a Text property for the specified string of controls

Scrolltoexact (String text)

Scroll to a Text property containing the passed-in string control

Context (String name)

Setting the context

Getcontexthandles ()

Available contexts

GetContext ()

Current context

Rotate (screenorientation orientation)

Setting screen or vertical screens

Getorientation ()

Get the current screen orientation

Findelementbyiosuiautomation (String using)

Take advantage of the properties in UIAutomation in iOS to get controls

Findelementsbyiosuiautomation (String using)

Same as above, but get multiple controls

Findelementbyandroiduiautomator (String using)

Take advantage of the properties in Android's Uiautoamtor to get a single control.

Findelementsbyandroiduiautomator (String using)

Same as above, but the method gets multiple controls

Findelementbyaccessibilityid (String using)

Using the accessibility ID to get a single control

Findelementsbyaccessibilityid (String using)

Using the accessibility ID to get multiple controls

Reproduced Appium's Java API

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.