appium driver参数及命令行参数
自己用的一套driver参数:
import time from appium import webdriver from util.operation_yaml import OperationYaml from data.settings import CONNECT_INFO_YAML, info_key_formatclass Driver:def __init__(self):# self.platform = platformself.oy = OperationYaml()def android(self,i):data = self.oy.read(CONNECT_INFO_YAML)info = data[info_key_format % int(i)]platform_version = info['platformVersion']device_name = info['deviceName']udid = info['udid']bport = info['bport']port = info['port']desired_caps = {'platformName': "Android",'platformVersion': "8",'deviceName': "d",# 'app': "/path/to/the/downloaded/ApiDemos-debug.apk",'appPackage': "com.tencent.mm",'appActivity': "com.tencent.mm.ui.LauncherUI",'automationName': "UiAutomator2",'systemPort': '8200','noReset': 'true','skipServerInstalltion': 'true', #跳过安装'udid': 'udid','newCommandTimeout': 120,'ensureWebviewsHavePages':'true',
'settings[waitForIdleTimeout]':0 #设置等待页面加载完成时间,默认10s}for i in range(15):try:return webdriver.Remote('http://127.0.0.1:%s/wd/hub' % port, desired_capabilities=desired_caps)except Exception as e:if i == 14:raise etime.sleep(1)def ios(self, i):data = self.oy.read(CONNECT_INFO_YAML)info = data[info_key_format % int(i)]platform_version = info['platformVersion']device_name = info['deviceName']udid = info['udid']wda_local_port = info['wda_local_port']port = info['port']desired_caps = {'autoAcceptAlerts': True,'automationName': 'XCUITest','bundleId': 'com.tencent.xin','deviceName': device_name,'newCommandTimeout': 120,'noReset': True,'platformName': 'iOS','platformVersion': platform_version,'udid': udid,'wdaLocalPort': wda_local_port,'xcodeOrgId': 'L8MRL9B64l'#开发者账号ID,加入开发者团队,主页会显示,这个是我随便写的一个}for i in range(15):try:return webdriver.Remote('http://127.0.0.1:%s/wd/hub' % port,desired_capabilities=desired_caps)except Exception as e:if i == 14:raise etime.sleep(1)if __name__ == '__main__':d = Driver().ios(0)
下方是官网的一套参数:
客服端参数地址:https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md
服务端参数地址:https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md
Capability | Description | Values |
---|---|---|
automationName
|
Which automation engine to use |
Appium (default), or UiAutomator2 , Espresso , or UiAutomator1 for Android, or XCUITest or Instruments for iOS, or YouiEngine for application built with You.i Engine
|
platformName
|
Which mobile OS platform to use |
iOS , Android , or FirefoxOS
|
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.... On iOS, this should be one of the valid devices returned by instruments with instruments -s devices . On Android this capability is currently ignored, though it remains required.
|
app
|
The absolute local path or remote http URL to a .ipa file (IOS), .app folder (IOS Simulator), .apk file (Android) or .apks file (Android App Bundle), or a .zip file containing 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 specify appPackage and appActivity capabilities (see below). UiAutomator2 and XCUITest allow to start the session without app or appPackage . Incompatible with browserName . See here about .apks file.
|
/abs/path/to/my.apk or http://myapp.com/app.ipa
|
otherApps
|
App or list of apps (as a JSON array) to install prior to running tests. Note that it will not work with automationName of Espresso and iOS real devices
|
e.g., "/path/to/app.apk" , https://www.example.com/url/to/app.apk , ["http://appium.github.io/appium/assets/TestApp9.4.app.zip", "/path/to/app-b.app"]
|
browserName
|
Name of mobile web browser to automate. Should be an empty string if automating an app instead. | 'Safari' for iOS and 'Chrome', '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
|
language
|
Language to set for iOS (XCUITest driver only) and Android. |
e.g. fr
|
locale
|
Locale to set for iOS (XCUITest driver only) and Android. fr_CA format for iOS. CA format (country name abbreviation) for Android
|
e.g. fr_CA , CA
|
udid
|
Unique device identifier of the connected physical device |
e.g. 1ae203187fc012g
|
orientation
|
(Sim/Emu-only) start in a certain orientation |
LANDSCAPE or PORTRAIT
|
autoWebview
|
Move directly into Webview context. Default false
|
true , false
|
noReset
|
Don't reset app state before this session. See here for more details |
true , false
|
fullReset
|
Perform a complete reset. See here for more details |
true , false
|
eventTimings
|
Enable or disable the reporting of the timings for various Appium-internal events (e.g., the start and end of each command, etc.). Defaults to false . To enable, use true . The timings are then reported as events property on response to querying the current session. See the event timing docs for the the structure of this response.
|
e.g., true
|
enablePerformanceLogging
|
(Web and webview only) Enable Chromedriver's (on Android) or Safari's (on iOS) performance logging (default false )
|
true , false
|
printPageSourceOnFindFailure
|
When a find operation fails, print the current page source. Defaults to false .
|
e.g., true
|
clearSystemFiles
|
Delete any generated files at the end of a session. Default to false .
|
true , false
|
Update settings
Capability | Description | Values |
---|---|---|
settings[settingsKey]
|
Update Appium Settings on session creation. |
e.g., 'settings[mjpegScalingFactor]': 10 , 'settings[shouldUseCompactResponses]': true
|
Android Only
These Capabilities are available only on Android-based drivers.
Capability | Description | Values |
---|---|---|
appActivity
|
Activity name for the Android activity you want to launch from your package. This often needs to be preceded by a . (e.g., .MainActivity instead of MainActivity ). By default this capability is received from the package manifest (action: android.intent.action.MAIN , category: android.intent.category.LAUNCHER)
|
MainActivity , .Settings
|
appPackage
|
Java package of the Android app you want to run. By default this capability is received from the package manifest (@package attribute value) |
com.example.android.myApp , com.android.settings
|
appWaitActivity
|
Activity name/names, comma separated, for the Android activity you want to wait for. By default the value of this capability is the same as for appActivity . You must set it to the very first focused application activity name in case it is different from the one which is set as appActivity if your capability has appActivity and appPackage . You can also use wildcards (* ).
|
SplashActivity , SplashActivity,OtherActivity , * , *.SplashActivity
|
appWaitPackage
|
Java package of the Android app you want to wait for. By default the value of this capability is the same as for appActivity
|
com.example.android.myApp , com.android.settings
|
appWaitDuration
|
Timeout in milliseconds used to wait for the appWaitActivity to launch (default 20000 )
|
30000
|
deviceReadyTimeout
|
Timeout in seconds while waiting for device to become ready |
5
|
allowTestPackages
|
Allow to install a test package which has android:testOnly="true" in the manifest. false by default
|
true or false
|
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
|
androidCoverageEndIntent
|
A broadcast action implemented by yourself which is used to dump coverage into file system. Passed to -a in adb shell am broadcast -a |
com.example.pkg.END_EMMA
|
androidDeviceReadyTimeout
|
Timeout in seconds used to wait for a device to become ready after booting |
e.g., 30
|
androidInstallTimeout
|
Timeout in milliseconds used to wait for an apk to install to the device. Defaults to 90000
|
e.g., 90000
|
androidInstallPath
|
The name of the directory on the device in which the apk will be push before install. Defaults to /data/local/tmp
|
e.g. /sdcard/Downloads/
|
adbPort
|
Port used to connect to the ADB server (default 5037 )
|
5037
|
systemPort
|
systemPort used to connect to appium-uiautomator2-server or appium-espresso-driver. The default is 8200 in general and selects one port from 8200 to 8299 for appium-uiautomator2-server, it is 8300 from 8300 to 8399 for appium-espresso-driver. When you run tests in parallel, you must adjust the port to avoid conflicts. Read Parallel Testing Setup Guide for more details.
|
e.g., 8201
|
remoteAdbHost
|
Optional remote ADB server host | e.g.: 192.168.0.101 |
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 (default 60000 )
|
300000
|
avdReadyTimeout
|
How long to wait in milliseconds for an 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, default false
|
true or false
|
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 should be used instead of original chromedriver bundled with Appium) |
/abs/path/to/webdriver
|
chromedriverArgs
|
An array of arguments to be passed to the chromedriver binary when it's run by Appium. By default no CLI args are added beyond what Appium uses internally (such as --url-base , --port , --adb-port , and --log-path .
|
e.g., ["--disable-gpu", "--disable-web-security"]
|
chromedriverExecutableDir
|
The absolute path to a directory to look for Chromedriver executables in, for automatic discovery of compatible Chromedrivers. Ignored if chromedriverUseSystemExecutable is true
|
/abs/path/to/chromedriver/directory
|
chromedriverChromeMappingFile
|
The absolute path to a file which maps Chromedriver versions to the minimum Chrome that it supports. Ignored if chromedriverUseSystemExecutable is true
|
/abs/path/to/mapping.json
|
chromedriverUseSystemExecutable
|
If true , bypasses automatic Chromedriver configuration and uses the version that comes downloaded with Appium. Ignored if chromedriverExecutable is set. Defaults to false
|
e.g., true
|
autoWebviewTimeout
|
Amount of time to wait for Webview context to become active, in ms. Defaults to 2000
|
e.g. 4
|
chromedriverPort
|
Numeric port to start Chromedriver on. Note that use of this capability is discouraged as it will cause undefined behavior in case there are multiple webviews present. By default Appium will find a free port. |
e.g. 8000
|
chromedriverPorts
|
A list of valid ports for Appium to use for communication with Chromedrivers. This capability supports multiple webview scenarios. The form of this capability is an array of numeric ports, where array items can themselves be arrays of length 2, where the first element is the start of an inclusive range and the second is the end. By default, Appium will use any free port. |
e.g. [8000, [9000, 9005]]
|
ensureWebviewsHavePages
|
Whether or not Appium should augment its webview detection with page detection, guaranteeing that any webview contexts which show up in the context list have active pages. This can prevent an error if a context is selected where Chromedriver cannot find any pages. Defaults to false
|
e.g. true
|
webviewDevtoolsPort
|
To support the ensureWebviewsHavePages feature, it is necessary to open a TCP port for communication with the webview on the device under test. This capability allows overriding of the default port of 9222 , in case multiple sessions are running simultaneously (to avoid port clash), or in case the default port is not appropriate for your system.
|
e.g. 9543
|
enableWebviewDetailsCollection
|
Enables collection of detailed WebView information via /json/version CDP (Chrome Developer Protocol) endpoint since Appium 1.18.0+. This helps to properly match Chromedriver version which supports the given WebView. Without this flag enabled, Appium tries to guess the version of the WebView based on the version of the corresponding installed package (which usually fails for custom web views). Defaults to false
|
true or false
|
dontStopAppOnReset
|
Doesn't stop the process of the app under test, before starting the app using adb. If the app under test is created by another anchor app, setting this false, allows the process of the anchor app to be still alive, during the start of the test app using adb. In other words, with dontStopAppOnReset set to true , we will not include the -S flag in the adb shell am start call. With this capability omitted or set to false , we include the -S flag. Default false
|
true or false
|
unicodeKeyboard
|
Enable Unicode input, default false
|
true or false
|
resetKeyboard
|
Reset keyboard to its original state, after running Unicode tests with unicodeKeyboard capability. Ignored if used alone. Default false
|
true or false
|
noSign
|
Skip checking and signing of app with debug keys, will work only with UiAutomator, default false
|
true or false
|
ignoreUnimportantViews
|
Calls the setCompressedLayoutHierarchy() uiautomator function. This capability can speed up test execution, since Accessibility commands will run faster ignoring some elements. The ignored elements will not be findable, which is why this capability has also been implemented as a toggle-able setting as well as a capability. Defaults to false
|
true or false
|
disableAndroidWatchers
|
Disables android watchers that watch for application not responding and application crash, this will reduce cpu usage on android device/emulator. This capability will work only with UiAutomator, default false
|
true or false
|
chromeOptions
|
Allows passing chromeOptions capability for ChromeDriver. For more information see chromeOptions |
chromeOptions: {args: ['--disable-popup-blocking']}
|
recreateChromeDriverSessions
|
Kill ChromeDriver session when moving to a non-ChromeDriver webview. Defaults to false
|
true or false
|
nativeWebScreenshot
|
In a web context, use native (adb) method for taking a screenshot, rather than proxying to ChromeDriver. Defaults to false
|
true or false
|
androidScreenshotPath
|
The name of the directory on the device in which the screenshot will be put. Defaults to /data/local/tmp
|
e.g. /sdcard/screenshots/
|
autoGrantPermissions
|
Have Appium automatically determine which permissions your app requires and grant them to the app on install. Defaults to false . If noReset is true , this capability doesn't work.
|
true or false
|
networkSpeed
|
Set the network speed emulation. Specify the maximum network upload and download speeds. Defaults to full
|
['full','gsm', 'edge', 'hscsd', 'gprs', 'umts', 'hsdpa', 'lte', 'evdo'] Check -netspeed option more info about speed emulation for avds
|
gpsEnabled
|
Toggle gps location provider for emulators before starting the session. By default the emulator will have this option enabled or not according to how it has been provisioned. |
true or false
|
isHeadless
|
Set this capability to true to run the Emulator headless when device display is not needed to be visible. false is the default value. isHeadless is also support for iOS, check XCUITest-specific capabilities.
|
e.g., true
|
adbExecTimeout
|
Timeout in milliseconds used to wait for adb command execution. Defaults to 20000
|
e.g., 50000
|
localeScript
|
Sets the locale script |
e.g., "Cyrl" (Cyrillic)
|
skipDeviceInitialization
|
Skip device initialization which includes i.a.: installation and running of Settings app or setting of permissions. Can be used to improve startup performance when the device was already used for automation and it's prepared for the next automation. Defaults to false
|
true or false
|
chromedriverDisableBuildCheck
|
Sets the chromedriver flag --disable-build-check for Chrome webview tests
|
true or false
|
skipUnlock
|
Skips unlock during session creation. Defaults to false
|
true or false
|
unlockType
|
Unlock the target device with particular lock pattern instead of just waking up the device with a helper app. It works with unlockKey capability. Defaults to undefined. fingerprint is available only for Android 6.0+ and emulators. Read unlock doc in android driver.
|
['pin', 'password', 'pattern', 'fingerprint']
|
unlockKey
|
A key pattern to unlock used by unlockType .
|
e.g., '1111' |
autoLaunch
|
Initializing the app under test automatically. Appium does not install/launch the app under test if this is false . Defaults to true
|
true or false
|
skipLogcatCapture
|
Skips to start capturing logcat. It might improve performance such as network. Log related commands will not work. Defaults to false .
|
true or false
|
uninstallOtherPackages
|
A package, list of packages or * to uninstall package/s before installing apks for test. '*' uninstall all of thrid-party packages except for packages which is necessary for Appium to test such as io.appium.settings or io.appium.uiautomator2.server since Appium already contains the logic to manage them.
|
e.g. "io.appium.example" , ["io.appium.example1", "io.appium.example2"] , '*'
|
disableWindowAnimation
|
Set device animation scale zero if the value is true . After session is complete, Appium restores the animation scale to it's original value. Defaults to false
|
true , false
|
remoteAppsCacheLimit
|
Set the maximum number of remote cached apks (default is 10) which are pushed to the device-under-test's local storage. Caching apks remotely speeds up the execution of sequential test cases, when using the same set of apks, by avoiding the need to be push an apk to the remote file system every time a reinstall is needed. Set this capability to 0 to disable caching.
|
e.g. 0 , 5 , 20
|
buildToolsVersion
|
Specify the Android build-tools version to be something different than the default, which is to use the most recent version. It is helpful to use a non-default version if your environment uses alpha/beta build tools.
|
e.g. '28.0.3'
|
androidNaturalOrientation
|
Allow for correct handling of orientation on landscape-oriented devices. Set to true to basically flip the meaning of PORTRAIT and LANDSCAPE . Defaults to false
|
true , false
|
enforceAppInstall
|
By default application installation is skipped if newer or the same version of this app is already present on the device under test. Setting this option to true will enforce Appium to always install the current application build independently of the currently installed version of it. Defaults to false .
|
true , false
|
ignoreHiddenApiPolicyError
|
Ignores Security exception: Permission denial alert and allows to continue the session creation process since Appium 1.18.0+. The error happens when Appium tries to relax hidden API policy, although some devices with a customized firmware deny such requests. Defaults to false .
|
true , false
|
mockLocationApp
|
Sets the package identifier of the app, which is used as a system mock location provider since Appium 1.18.0+. This capability has no effect on emulators. If the value is set to null or an empty string, then Appium will skip the mocked location provider setup procedure. Defaults to Appium Setting package identifier (io.appium.settings ).
|
e.g., null , io.appium.settings , example.your.app
|
logcatFormat |
Set the output format for logcat messages since Appium 1.18.0. Supported formats are listed in here. Please read logcat#outputFormat for more details about each format. Defaults to threadtime .
|
e.g., process
|
logcatFilterSpecs | Set the output filter rule for logcat messages since Appium 1.18.0. Please read logcat#filteringOutput for more details about the rule. Write and View Logs with Logcat is also helpful. |
e.g., ['*:W', 'MyActivity:D'] (MyActivity is a tag)
|
allowDelayAdb |
Whether enable -delay-adb on emulator startup. Defaults to true
|
true , false
|
UIAutomator 1
These Capabilities are available on UIAutomator 1.
Capability | Description | Values |
---|---|---|
intentAction
|
Intent action which will be used to start activity (default android.intent.action.MAIN )
|
e.g.android.intent.action.MAIN , android.intent.action.VIEW
|
intentCategory
|
Intent category which will be used to start activity (default android.intent.category.LAUNCHER )
|
e.g. android.intent.category.LAUNCHER , android.intent.category.APP_CONTACTS
|
intentFlags
|
Flags that will be used to start activity (default 0x10200000 )
|
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.
|
UIAutomator2 Only
Please refer to the documentation on the UIAutomator2 driver repository about its available capabilities.
Espresso Only
Please refer to the documentation on the Espresso driver repository about its available capabilities.
iOS Only
These Capabilities are available only on the XCUITest Driver and the deprecated UIAutomation Driver.
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. To run a test on a real device using the bundle ID, you may omit the 'app' capability, but you must provide 'udid'. |
e.g. io.appium.TestApp
|
udid
|
Unique device identifier of the connected physical device |
e.g. 1ae203187fc012g
|
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. |
true or false
|
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 use the bundleId capability to send in your app's bundle ID.
|
true or false
|
autoAcceptAlerts
|
Accept all iOS alerts automatically if they pop up. This includes privacy access permission alerts (e.g., location, contacts, photos). Default is false. |
true or false
|
autoDismissAlerts
|
Dismiss all iOS alerts automatically if they pop up. This includes privacy access permission alerts (e.g., location, contacts, photos). Default is false. |
true or false
|
nativeInstrumentsLib
|
Use native intruments lib (ie disable instruments-without-delay). |
true or false
|
nativeWebTap
|
Enable "real", non-javascript-based web taps in Safari. Default: false . Warning: depending on viewport size/ratio; this might not accurately tap an element
|
true or false
|
safariInitialUrl
|
Initial safari url, default is a local welcome page |
e.g. https://www.github.com
|
safariAllowPopups
|
(Sim-only) Allow javascript to open new windows in Safari. Default keeps current sim setting |
true or false
|
safariIgnoreFraudWarning
|
(Sim-only) Prevent Safari from showing a fraudulent website warning. Default keeps current sim setting. |
true or false
|
safariOpenLinksInBackground
|
(Sim-only) Whether Safari should allow links to open in new windows. Default keeps current sim setting. |
true or false
|
keepKeyChains
|
(Sim-only) Whether to keep keychains (Library/Keychains) when appium session is started/finished |
true or false
|
localizableStringsDir
|
Where to look for localizable strings. Default en.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
|
showIOSLog
|
Whether to show any logs captured from a device in the appium logs. Default false
|
true or false
|
sendKeyStrategy
|
strategy to use to type test into a test field. Simulator default: oneByOne . Real device default: grouped
|
oneByOne , grouped or setValue
|
screenshotWaitTimeout
|
Max timeout in sec to wait for a screenshot to be generated. default: 10 |
e.g., 5
|
waitForAppScript
|
The ios automation script used to determined if the app has been launched, by default the system wait for the page source not to be empty. The result must be a boolean |
e.g. true; , target.elements().length > 0; , $.delay(5000); true;
|
webviewConnectRetries
|
Number of times to send connection message to remote debugger, to get webview. Default: 8
|
e.g., 12
|
appName
|
The display name of the application under test. Used to automate backgrounding the app in iOS 9+. |
e.g., UICatalog
|
customSSLCert
|
(Sim only) Add an SSL certificate to IOS Simulator. |
e.g.-----BEGIN CERTIFICATE-----MIIFWjCCBEKg... -----END CERTIFICATE-----
|
webkitResponseTimeout
|
(Real device only) Set the time, in ms, to wait for a response from WebKit in a Safari session. Defaults to 5000
|
e.g., 10000
|
remoteDebugProxy
|
(Sim only, <= 11.2) If set, Appium sends and receives remote debugging messages through a proxy on either the local port (Sim only, <= 11.2) or a proxy on this unix socket (Sim only >= 11.3) instead of communicating with the iOS remote debugger directly. |
e.g. 12000 or "/tmp/my.proxy.socket"
|
enableAsyncExecuteFromHttps
|
capability to allow simulators to execute asynchronous JavaScript on pages using HTTPS. Defaults to false
|
true or false
|
skipLogCapture
|
Skips to start capturing logs such as crash, system, safari console and safari network. It might improve performance such as network. Log related commands will not work. Defaults to false .
|
true or false
|
webkitDebugProxyPort
|
(Real device only) Port to which ios-webkit-debug-proxy is connected, during real device tests. Default is 27753 .
|
12021
|
fullContextList
|
Returns the detailed information on contexts for the get available context command. If this capability is enabled, then each item in the returned contexts list would additionally include WebView title, full URL and the bundle identifier. Defaults to false .
|
true or false
|
Appium 服务器参数
许多 Appium 1.5 中的服务器参数已被弃用,取而代之使用的是 -default-capabilities 标识 。
用法:node . [标志]
服务器标志
所有标志都是可选的,但是有些必须跟指定标志组合使用才生效。
标志 | 默认 | 描述 | 示例 |
---|---|---|---|
--shell
|
null | 进入 REPL 模式 | |
--allow-cors
|
false | 打开 CORS 兼容模式,这将允许从托管在任何域中的网站内连接到 Appium 服务器。启用此功能时要小心,因为如果您访问的网站使用跨域请求,在 Appium 服务器上启动或运行内省会话,则可能存在安全风险。 | |
--ipa
|
null | (仅 iOS).ipa 文件的绝对路径 |
--ipa /abs/path/to/my.ipa
|
-a , --address
|
0.0.0.0 | 监听的 ip 地址 |
--address 0.0.0.0
|
-p , --port
|
4723 | 监听的端口 |
--port 4723
|
-ca , --callback-address
|
null | 回调 ip 地址 (默认:与 --address 相同) |
--callback-address 127.0.0.1
|
-cp , --callback-port
|
null | 回调端口(默认:与 --port 相同) |
--callback-port 4723
|
-bp , --bootstrap-port
|
4724 | (仅 Android)设备跟 Appium 通信的端口 |
--bootstrap-port 4724
|
-r , --backend-retries
|
3 | (仅 iOS)遇到 crash 或者超时,尝试重启Instruments的次数 |
--backend-retries 3
|
--session-override
|
false | 允许 session 覆盖(如有冲突) | |
-l , --pre-launch
|
false | 首次建立session时预启动应用(iOS 需要 –app 参数,Android 需要 –app-pkg 和 –app-activity 参数) | |
-g , --log
|
null | 将日志输出到指定文件 |
--log /path/to/appium.log
|
--log-level
|
debug |
为控制台和日志文件设置服务器日志等级(值为 console-level:logfile-level ,如果只提供一个值,则两者相同)。可选的值为 debug 、info 、warn 、error ,并且越往后,日志越少。
|
--log-level error:debug
|
--log-timestamp
|
false | 在终端输出中显示时间戳 | |
--local-timezone
|
false | 时间戳使用本地时区 | |
--log-no-colors
|
false | 终端输出不为彩色 | |
-G , --webhook
|
null | 同时发送日志输出到 HTTP 监听器 |
--webhook localhost:9876
|
--safari
|
false | (仅iOS)使用 safari 应用程序 | |
--default-device , -dd
|
false | (仅iOS模拟器)使用默认模拟器启动 Instruments | |
--force-iphone
|
false | (仅 iOS)不管应用程序指定什么设备,都强制使用 iPhone 模拟器 | |
--force-ipad
|
false | (仅 iOS)不管应用程序指定什么设备,都强制使用 iPad 模拟器 | |
--tracetemplate
|
null | (仅 iOS) 指定 Instruments 所使用的 .tracetemplate 文件 |
--tracetemplate /Users/me/Automation.tracetemplate
|
--instruments
|
null | (仅 iOS)Instruments 二进制文件的路径 |
--instruments /path/to/instruments
|
--nodeconfig
|
null | 指定 JSON 格式的配置文件,用于在 selenium grid 中注册 appium |
--nodeconfig /abs/path/to/nodeconfig.json
|
-ra , --robot-address
|
0.0.0.0 | robot 的 IP 地址 |
--robot-address 0.0.0.0
|
-rp , --robot-port
|
-1 | robot 的端口号 |
--robot-port 4242
|
--selendroid-port
|
8080 | 用于和 Selendroid 通信的本地端口 |
--selendroid-port 8080
|
--chromedriver-port
|
9515 | ChromeDriver 运行使用的端口 |
--chromedriver-port 9515
|
--chromedriver-executable
|
null | ChromeDriver 可执行文件的完整路径 | |
--show-config
|
false | 打印 appium 服务器的配置信息,然后退出 | |
--no-perms-check
|
false | 绕过Appium检查,确保我们可以读 / 写必要的文件 | |
--strict-caps
|
false | 如果所选设备不能被 appium 有效识别,则导致会话失败 | |
--isolate-sim-device
|
false | Xcode 6 在某些平台上存在存在一个 bug,想要正确启动某个模拟器,只能去删除掉所有其他模拟器。这个选项将导致了 Appium 删除除了正在使用的设备以外其他所有设备。请注意,这是永久性删除,你可以使用 simctl 或 xcode 管理被 Appium 使用的设备类别。 | |
--tmp
|
null | 目录的绝对路径将被 Appium 用于管理临时文件,比如存放需要移动的内置 iOS 应用程序。在 *nix / Mac 上默认为 /tmp,在 Windows 上默认为 C:\Windows\Temp | |
--trace-dir
|
null | appium 用于保存iOS instruments 轨迹的目录,是绝对路径,默认为 /appium-instruments | |
--debug-log-spacing
|
false | 在日志中加大间距,帮助进行视觉检查 | |
--suppress-adb-kill-server
|
false | (仅 Android) 如果设置了,可以阻止 Appium 杀掉 adb 实例 | |
--async-trace
|
false | 向日志条目添加长堆栈追踪。建议仅在调试时使用 | |
--webkit-debug-proxy-port
|
27753 | (仅 iOS)用于 ios-webkit-debug-proxy 通信的本地端口 |
--webkit-debug-proxy-port 27753
|
-dc , --default-capabilities
|
{} | 设置默认预期功能(Desired capabilities),每个会话都将使用默认预期功能,除非被新的功能覆盖 |
--default-capabilities [ '{"app": "myapp.app", "deviceName": "iPhone Simulator"}' | /path/to/caps.json ]
|
--reboot
|
false | - (仅 Android)每次建立会话都重启模拟器,会话结束后杀掉模拟器 | |
--command-timeout
|
60 | 【弃用】- 没有效果。这曾是服务器用于所有会话接收命令的默认超时时间(单位是秒,但不超过 2147483)。预期能力(Desired capabilities)中的 newCommandTimeout 替代 | |
-k , --keep-artifacts
|
false | 【弃用】 - 没有效果。trace 现在默认位于 tmp 目录下,每次运行前都会清除。请查考 --trace-dir 标识 | |
--platform-name
|
null | 【弃用】 - 移动平台名称:iOS、Android 或 FirefoxOS |
--platform-name iOS
|
--platform-version
|
null | 【弃用】 - 移动平台的版本号 |
--platform-version 7.1
|
--automation-name
|
null | 【弃用】 - 自动化工具的名称: Appium 或 Selendroid |
--automation-name Appium
|
--device-name
|
null | 【弃用】 - 将使用的移动设备的名称 |
--device-name iPhone Retina (4-inch), Android Emulator
|
--browser-name
|
null | 【弃用】 - 移动浏览器的名称: Safari 或者 Chrome |
--browser-name Safari
|
--app
|
nul | 【弃用】 - IOS:基于模拟器编译的 .app 文件的绝对路径或者设备上目标的 BundleId; Android:.apk 文件的绝对路径 |
--app /abs/path/to/my.app
|
-lt , --launch-timeout
|
90000 | 【弃用】 - (仅iOS) Instruments启动等待时间(单位:ms) | |
--language
|
null | 【弃用】 - iOS 模拟器 / Android 模拟器的语言 |
--language en
|
--locale
|
null | 【弃用】 - iOS 模拟器 / Android 模拟器的区域 |
--locale en_US
|
-U , --udid
|
null | 【弃用】 - 连接的物理设备的 udid |
--udid 1adsf-sdfas-asdf-123sdf
|
--orientation
|
null | 【弃用】 - (仅 iOS) 初始化请求时,使用 LANDSCAPE 或者 PORTRAIT |
--orientation LANDSCAPE
|
--no-reset
|
false | 【弃用】 - 会话(session)之间不重置应用状态(IOS: 不删除应用的 plist 文件;Android:在创建一个新的session前不删除应用) | |
--full-reset
|
false | 【弃用】 - (iOS)删除整个模拟器目录。(Android)通过卸载应用(而不是清除数据)重置应用状态。在 Android 中会话(session)完成后也会删除应用。 | |
--app-pkg
|
null | 【弃用】 - (仅 Android)想要运行的 apk 的 java 包(例如, com.example.android.myApp) |
--app-pkg com.example.android.myApp
|
--app-activity
|
null | 【弃用】 - (仅 Android)打开应用时,想要启动的 Activity 的名称(例如 MainActivity) |
--app-activity MainActivity
|
--app-wait-package
|
false | 【弃用】 - (仅 Andorid)想要等待的 activity 的包名(例如 com.example.android.myApp) |
--app-wait-package com.example.android.myApp
|
--app-wait-activity
|
false | 【弃用】 - (仅 Andorid)想要等待的 activity 名(例如 SplashActivity) |
--app-wait-activity SplashActivity
|
--device-ready-timeout
|
5 | 【弃用】 - (仅 Andorid)等待设备准备就绪的超时时间(单位:秒) |
--device-ready-timeout 5
|
--android-coverage
|
false | 【弃用】 - (仅 Andorid)完全符合条件的 instrumentation 类,作为命令 adb shell am instrument -e coverage true -w 中的 -w 的参数 |
--android-coverage com.my.Pkg/com.my.Pkg.instrumentation.MyInstrumentation
|
--avd
|
null | 【弃用】 - (仅 Andorid)要启动的安卓虚拟设备的名称 |
--avd @default
|
--avd-args
|
null | 【弃用】 - (仅 Andorid)启动安装虚拟设备时额外的模拟器参数 |
--avd-args -no-snapshot-load
|
--use-keystore
|
false | 【弃用】 - (仅 Andorid)设置 apk 签名的 keystore | |
--keystore-path
|
<user>/.android/debug.keystore | 【弃用】 - (仅 Andorid)keystore 的路径 | |
--keystore-password
|
android | 【弃用】 - (仅 Andorid)keystore 的密码 | |
--key-alias
|
androiddebugkey | 【弃用】 - (仅 Andorid)key 的别名 | |
--key-password
|
android | 【弃用】 - (仅 Andorid)key 的密码 | |
--intent-action
|
android.intent.action.MAIN | 【弃用】 - (仅 Andorid)用于启动 activity 的 Intent action |
--intent-action android.intent.action.MAIN
|
--intent-category
|
android.intent.category.LAUNCHER | 【弃用】 - (仅 Andorid)用于启动 activity 的 Intent category |
--intent-category android.intent.category.APP_CONTACTS
|
--intent-flags
|
0x10200000 | 【弃用】 - (仅 Andorid)启动 activity 的标识 |
--intent-flags 0x10200000
|
--intent-args
|
null | 【弃用】 - (仅 Andorid)启动 activity 时附带额外的 intent 参数 |
--intent-args 0x10200000
|
--dont-stop-app-on-reset
|
false | 【弃用】 - (仅 Andorid)用于设置 appium 重启时是否先杀掉 app | |
--calendar-format
|
null | 【弃用】 - (仅 iOS)iOS 模拟器的日历格式 |
--calendar-format gregorian
|
--native-instruments-lib
|
false | 【弃用】 - (仅 iOS)iOS 内建了一个怪异的不可能避免的延迟,我们在Appium里修复了它,如果你想用原来的,你可以使用这个参数 | |
--keep-keychains
|
false | 【弃用】 - (仅 iOS) 当 Appium 启动或者关闭的时候,是否保留keychains(Library / Keychains) | |
--localizable-strings-dir
|
en.lproj | 【弃用】 - (仅 iOS)Localizable.strings 与目录的相对路径 |
--localizable-strings-dir en.lproj
|
--show-ios-log
|
false | 【弃用】 - (仅 iOS)如果设置了,iOS 系统日志将会输出到终端 | |
--relaxed-security
|
false | 禁用额外的安全检查,因此可以使用支持此选项的驱动程序提供的某些高级功能。只有当所有客户端都位于可信任网络中,才启用它;如果客户端可能会突破会话沙箱,则不应该启用它。 |
appium driver参数及命令行参数相关推荐
- python 命令行参数-Python命令行参数处理
sys模块 sys模块代表了Python解释器,主要用于获取和Python解释器相关的信息,其中 sys.argv 可以获取命令行参数 在Python交互式解释器中可以先导入sys模块 import ...
- python 命令行参数-Python3 命令行参数
Python3 命令行参数 Python 提供了 getopt 模块来获取命令行参数. $ python test.py arg1 arg2 arg3 Python 中也可以所用 sys 的 sys. ...
- python 命令行参数-Python 命令行参数解析
Python用于编写脚本的场景非常多,如何处理脚本(命令行)的参数当然非常关键 首先导入sys,参数列表在sys.arg中 import sys if __name__ == '__main__': ...
- mysql命令参数_MySQL命令行参数完整版
MySQL命令行参数完整版 mysql教程支持下面的选项: ---help,-? 显示帮助消息并退出. --batch,-B 打印结果,使用tab作为列间隔符,每个行占用新的一行.使用该选项,则mys ...
- java 命令行参数 _java命令行参数
原标题:java命令行参数 命令行参数就是main方法里面的参数String[] args他就是一个数组,args只是数据类型的一个名称,就是一个数组的变量,名称无所谓,类型没变就行了.这个就是程序的 ...
- python 参数_Python命令行参数(七)
Python提供了一个getopt模块,用于解析命令行选项和参数. $ python test.py arg1 arg2 arg3 Python sys模块通过sys.argv提供对任何命令行参数的访 ...
- 通过命令行获取计算机参数,Win32命令行参数的传到和获取
Win32命令行参数的传入和获取 Win32控制台,如何传入和获取命令行参数的有关问题, 有几种解决办法, 总结出来,朋友们一起分享 // tt.cpp : 定义控制台应用程序的入口点. // #in ...
- python 命令行参数_Python 命令行参数介绍
Python 提供了 getopt 模块来获取命令行参数. Python 中也可以所用 sys 的 sys.argv 来获取命令行参数: sys.argv 是命令行参数列表. len(sys.argv ...
- python 命令行 参数_Python命令行参数
python 命令行 参数 Python Command line arguments are input parameters passed to the script when executing ...
- python命令行输入参数_Python命令行参数处理
sys模块 sys模块代表了Python解释器,主要用于获取和Python解释器相关的信息,其中 sys.argv 可以获取命令行参数 在Python交互式解释器中可以先导入sys模块 import ...
最新文章
- OpenCV环境下Laplace(拉普拉斯)和Roberts基本边缘检测算子的实现代码
- 转:保留小数点后四位,不足自动补0
- 关于百度地图api测距显示NaN的解决方案
- python使用MySQL数据库
- 面试必会系列 - 4.1 程序员必须掌握的:计算机组成、操作系统知识点汇总
- Win10无法使用小娜搜索本地应用问题的解决方案
- 软件工程详细设计说明书_软件工程导论知识点梳理之简答题
- 95-235-065-源码-task-SourceStreamTask
- c语言程序设计的常用算法,《C语言程序设计的常用算法.doc
- try catch finally return
- 如何在Mac上更改声音输出设置呢?
- 【MFC学习笔记-作业7-小型画图软件】【】
- Spring和Mybatis整合-原生dao开发
- 如何取消WPS 2019启动就显示稻壳商城?关闭后如何打开?
- 3个方法解决百度网盘限速(转)
- 哈佛大学公开课-幸福课-个人笔记
- 【项目管理】测量绩效域管理
- 学习笔记:星火第一讲-使用Apollo 学习自动驾驶
- Android谷歌推送
- 日常学习——记使用POI多线程写Excel数据(续)
热门文章
- 马来西亚留学回国人员证明
- python变量、数据类型
- 如何实现一个游戏地图编辑器
- 生成订单30分钟未支付,则自动取消,该怎么实现?
- R语言 | 计算基因表达量 TPM R脚本
- 东航手机值机选座推荐
- Ubunt14.04搭建opengrok环境
- c语言音阶数组,【项目6-任务7-小组14】蜂鸣器演奏简单乐曲及简易电子琴制作...
- Hypervisor是什么
- letax报错“ I can't write on file `***.pdf”