Description of the Capabilities passed to the Appium server to enable the corresponding Android Automation session.

Source: Internet
Author: User

Description of the Capabilities passed to the Appium server to enable the corresponding Android Automation session.

Desired Capabilities is a set of key-value pairs sent by the client to the Appium server to tell the server which session we want to start. Some key-value pairs are used to modify the behavior of the server during the automation process. For example, we can set the capability value of the key platformNameiOSTo tell the server that we want to enable an iOS session instead of an Anddroid session. Or we can set the keysafariAllowPopupsSet the capability valuetrueTo ensure that a new window can be popped up using JavaScript during the Safari automatic session process. To view the complete list of capabilities supported by Appium, see the capabilities doc or the following documents.

Note the highlighted items in the following list. These are mandatory items. Note the following:

  • DeviceName:No matter what value I enter, I can run the test on my HTC Incredable S machine, but this is required. I used Appium V1.2.2.
  • App: If this parameter is set, appium will install the test target app on the target machine. If not, the app will be searched for on the target machine based on appActivity and appPackage.
  • AppPackage: You can use the aapt tool provided by the sdk.
  • AppActivity: You can also use the above tools. One thing to note is that the value can be appended with packageName or not, that is, the following two filling methods are correct. notesList "and" com. example. android. notepad. notesList"


Appium server capabilities

Capability Description Values
automationName Which automation engine to use Appium(Default) orSelendroid
platformName Which mobile OS platform to use iOS,Android, OrFirefoxOS
platformVersion Mobile OS version E.g .,7.1,4.4
deviceName The kind of mobile device or emulator to use iPhone Simulator,iPad Simulator,iPhone Retina 4-inch,Android Emulator,Galaxy S4, Etc...
app The absolute local pathOrRemote http URL to.ipaOr.apkFile, or.zipContaining one of these. Appium will attempt to install this app binary on the appropriate device first. Note that this capability is not required for Android if you specifyappPackageAndappActivityCapabilities (see below). IncompatiblebrowserName. /abs/path/to/my.apkOrhttp://myapp.com/app.ipa
browserName Name of mobile web browser to automate. shocould be an empty string if automating an app instead. 'Safari 'for iOS and 'chromium', 'chromium ', or 'browser' for Android
newCommandTimeout How long (in seconds) Appium will wait for a new command from the client before assuming the client quit and ending the session E.g.60
autoLaunch Whether to have Appium install and launch the app automatically. Defaulttrue true,false
language (Sim/Emu-only) Language to set for the simulator/emulator E.g.fr
locale (Sim/Emu-only) Locale to set for the simulator/emulator E.g.fr_CA
udid Unique device identifier of the connected physical device E.g.1ae203187fc012g
orientation (Sim/Emu-only) start in a certain orientation LANDSCAPEOrPORTRAIT
autoWebview Move directly into Webview context. Defaultfalse true,false
noReset Don't reset app state before this session. Defaultfalse true,false
fullReset (IOS) Delete the entire simulator folder. (Android) Reset app state by uninstalling app instead of clearing app data. On Android, this will also remove the app after the session is complete. Defaultfalse true,false
ANDROID ONLY
Capability Description Values
appActivity Activity name for the Android activity you want to launch from your package MainActivity,.Settings
appPackage Java package of the Android app you want to run com.example.android.myApp,com.android.settings
appWaitActivity Activity name for the Android activity you want to wait SplashActivity
appWaitPackage Java package of the Android app you want to wait com.example.android.myApp,com.android.settings
deviceReadyTimeout Timeout in seconds while waiting for device to become ready 5
androidCoverage Fully qualified instrumentation class. Passed to-w in adb shell am instrument-e coverage true-w com.my.Pkg/com.my.Pkg.instrumentation.MyInstrumentation
enablePerformanceLogging (Chrome and webview only) Enable Chromedriver's performance logging (defaultfalse) true,false
androidDeviceReadyTimeout Timeout in seconds used to wait for a device to become ready after booting E.g .,30
androidDeviceSocket Devtools socket name. Needed only when tested app is a Chromium embedding browser. The socket is open by the browser and Chromedriver connects to it as a devtools client. E.g .,chrome_devtools_remote
avd Name of avd to launch E.g .,api19
avdLaunchTimeout How long to wait in milliseconds for an avd to launch and connect to ADB (default120000) 300000
avdReadyTimeout How long to wait in milliseconds for an avd to finish its boot animations (default120000) 300000
avdArgs Additional emulator arguments used when launching an avd E.g .,-netfast
useKeystore Use a custom keystore to sign apks, defaultfalse trueOrfalse
keystorePath Path to custom keystore, default ~ /. Android/debug. keystore E.g .,/path/to.keystore
keystorePassword Password for custom keystore E.g .,foo
keyAlias Alias for key E.g .,androiddebugkey
keyPassword Password for key E.g .,foo
chromedriverExecutable The absolute local path to webdriver executable (if Chromium embedder provides its own webdriver, it shocould be used instead of original chromedriver bundled with Appium) /abs/path/to/webdriver
specialChromedriverSessionArgs Custom arguments passed directly to chromedriver in chromeOptions capability. Passed as object which properties depend on a specific webdriver. E.g .,{'androidDeviceSocket': 'opera_beta_devtools_remote',}
autoWebviewTimeout Amount of time to wait for Webview context to become active, in ms. Defaults2000 E.g.4
intentAction Intent action which will be used to start activity (defaultandroid.intent.action.MAIN) E.g.android.intent.action.MAIN,android.intent.action.VIEW
intentCategory Intent category which will be used to start activity (defaultandroid.intent.category.LAUNCHER) E.g.android.intent.category.LAUNCHER,android.intent.category.APP_CONTACTS
intentFlags Flags that will be used to start activity (default0x10200000) E.g.0x10200000
optionalIntentArguments Additional intent arguments that will be used to start activity. See Intent arguments E.g.--esn <EXTRA_KEY>,--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>, Etc.
unicodeKeyboard Enable Unicode input, defaultfalse trueOrfalse
resetKeyboard Reset keyboard to its original state, after running Unicode testsunicodeKeyboardCapability. Ignored if used alone. Defaultfalse trueOrfalse
IOS ONLY
Capability Description Values
calendarFormat (Sim-only) Calendar format to set for the iOS Simulator E.g.gregorian
bundleId Bundle ID of the app under test. Useful for starting an app on a real device or for using other caps which require the bundle ID during test startup E.g.io.appium.TestApp
launchTimeout Amount of time in MS to wait for instruments before assuming it hung and failing the session E.g.20000
locationServicesEnabled (Sim-only) Force location services to be either on or off. Default is to keep current sim setting. trueOrfalse
locationServicesAuthorized (Sim-only) Set location services to be authorized or not authorized for app via plist, so that location services alert doesn't pop up. default is to keep current sim setting. note that if you use this setting you MUST also usebundleIdCapability to send in your app's bundle ID. trueOrfalse
autoAcceptAlerts Accept iOS privacy access permission alerts (e.g., location, contacts, photos) automatically if they pop up. Default is false. trueOrfalse
nativeInstrumentsLib Use native intruments lib (ie disable instruments-without-delay ). trueOrfalse
nativeWebTap (Sim-only) Enable "real", non-javascript-based web taps in Safari. Default:false. Warning: depending on viewport size/ratio this might not accurately tap an element trueOrfalse
safariAllowPopups (Sim-only) Allow javascript to open new windows in Safari. Default keeps current sim setting trueOrfalse
safariIgnoreFraudWarning (Sim-only) Prevent Safari from showing a fraudulent website warning. Default keeps current sim setting. trueOrfalse
safariOpenLinksInBackground (Sim-only) Whether Safari shoshould allow links to open in new windows. Default keeps current sim setting. trueOrfalse
keepKeyChains (Sim-only) Whether to keep keychains (Library/Keychains) when appium session is started/finished trueOrfalse
localizableStringsDir Where to look for localizable strings. Defaulten.lproj en.lproj
processArguments Arguments to pass to the AUT using instruments E.g .,-myflag
interKeyDelay The delay, in MS, between keystrokes sent to an element when typing. E.g .,100

The following is a configuration example:

    public void setUp() throws Exception {        // set up appium        File classpathRoot = new File(System.getProperty("user.dir"));        File appDir = new File(classpathRoot, "apps");        File app = new File(appDir, "NotePad.apk");        DesiredCapabilities capabilities = new DesiredCapabilities();        capabilities.setCapability("deviceName","iPad Simulator");        //capabilities.setCapability("platformVersion", "4.2");        capabilities.setCapability("platformName", "Android");        capabilities.setCapability("app", app.getAbsolutePath());        //capabilities.setCapability("appPackage", "com.example.android.notepad");        //capabilities.setCapability("appActivity", "com.example.android.notepad.NotesList");        //capabilities.setCapability("appActivity", ".NotesList");        driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);    }





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.