Several instructions for passing to the Appium server to open the capabilities of the corresponding Android Automation session "Turn"

Source: Internet
Author: User
Tags appium

  1. Desired capabilities is a set of key-value pairs that the client sends to the Appium server to tell the server what kind of session we want to start. There are also key-value pairs that are used to modify the behavior of the server side in the process of automation. For example, we can set the value of the capability of the key to PlatformName iOS to tell the server that we want to open an iOS session, not a anddroid session. Or we can set the value of the key to safariAllowPopups capability true to make sure that we can use JavaScript to pop up a new window during the Safari automation session. To view the complete list of capabilities supported by Appium, view the capabilities doc or the following documentation.

    Note the highlighted items in the following list, which are required items. The following points need to be noted:

      • devicename: I can run through the test on my HTC incredable s machine, no matter what the value is, but it has to be filled out. The Appium version I used was V1.2.2.
      • app : If you fill out, Appium will install the test target app on the target machine, and if not, will find the target app based on Appactivity and Apppackage to the target machine.
      • apppackage : Can be obtained by using the SDK's own tool AAPT
      • appactivity: Also available through the tools above. One thing to note is that the value can be attached packagename, or not attached, which means that the following two methods of filling are right. 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 path  or  remote http URL to An .ipa  or  .apk  file, or A .zip   Containing one of these. Appium'll attempt to install this app binary on the appropriate device first. note that this capability is not requ Ired for Android If you specify apppackage  and  appactivity  capabilities (see below). Incompatible With browsername . /abs/path/to/my.apk  or http:// Myapp.com/app.ipa
    browserName Name of mobile web browser to automate. Should be a empty string if automating an app instead. ' Safari ' for IOS and ' Chrome ', ' Chromium ', or ' Browser ' for Android
    newCommandTimeout How long (in seconds) Appium would wait for a new command from the client before assuming the client quit and ending the SE Ssion e.g.60
    autoLaunch Whether to has 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 the 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 would also remove the app after the session was complete. Defaultfalse true,false
    ANDROID only
    Capability Description Values
    appActivity Activity name for the Android activity want to launch from your package MainActivity,.Settings
    appPackage Java package of the Android app-want to run com.example.android.myApp,com.android.settings
    appWaitActivity Activity name for the Android activity want to wait for SplashActivity
    appWaitPackage Java package of the Android app-want to wait for com.example.android.myApp,com.android.settings
    deviceReadyTimeout Timeout in seconds and 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 (default false ) 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 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 a AVD to launch and connect to ADB (default 120000 ) 300000
    avdReadyTimeout How long-to-wait in milliseconds for a AVD to finish its boot animations (default 120000 ) 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 their own webdriver, it should be used Instea D 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 Defaults to2000 e.g.4
    intentAction Intent action which is used to start activity (default android.intent.action.MAIN ) e.g. android.intent.action.MAIN ,android.intent.action.VIEW
    intentCategory Intent category which is used to start activity (default android.intent.category.LAUNCHER ) e.g. android.intent.category.LAUNCHER ,android.intent.category.APP_CONTACTS
    intentFlags Flags that'll be used to start activity (default 0x10200000 ) e.g.0x10200000
    optionalIntentArguments Additional intent arguments that'll be the 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 their original state, after the running Unicode tests with unicodeKeyboard capability. 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 is either on or off. The Default is to keep the current SIM setting. trueOrfalse
    locationServicesAuthorized (sim-only) Set Location services to is authorized or not authorized for app via plist, so the location services alert doesn ' t pops up . The Default is to keep the current SIM setting. Note If you use this setting must also with the capability to bundleId send in your app's bundle ID. trueOrfalse
    autoAcceptAlerts Accept IOS Privacy access permission alerts (e.g., location, contacts, photos) automatically if they pops 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 should 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 was 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 a element when typing. e.g.,100

    Here is a sample configuration:

    [Java]View Plaincopy
    1. Public void SetUp () throws Exception {
    2. //Set up Appium
    3. File Classpathroot = new File (System.getproperty ("User.dir"));
    4. File Appdir = new File (Classpathroot, "apps");
    5. File app = new File (Appdir, "notepad.apk");
    6. Desiredcapabilities capabilities = new Desiredcapabilities ();
    7. Capabilities.setcapability ("DeviceName","IPad Simulator");
    8. //capabilities.setcapability ("Platformversion", "4.2");
    9. Capabilities.setcapability ("PlatformName", "Android");
    10. Capabilities.setcapability ("app", App.getabsolutepath ());
    11. //capabilities.setcapability ("Apppackage", "Com.example.android.notepad");
    12. //capabilities.setcapability ("appactivity", "com.example.android.notepad.NotesList");
    13. //capabilities.setcapability ("Appactivity", ".  Noteslist ");
    14. Driver = New Appiumdriver (new URL ("Http://127.0.0.1:4723/wd/hub"), capabilities);
    15. }

Several instructions for passing to the Appium server to open the capabilities of the corresponding Android Automation session "Turn"

Related Article

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.