Appium的DesiredCapabilities参数设置

上一篇 / 下一篇  2015-11-26 13:54:10 / 个人分类:手机自动化

Appium的DesiredCapabilities参数设置

DesiredCapabilities 负责启动服务端时的参数设置。实际使用时根据自己的需要,可自行修改一些参数。

比如,应用程序在查找某个页面的元素时,定位可能会时间超长。默认的命令间隔时间是60s,如果在60s内没有找到,就会自动退出。可以使用newCommandTimeout设置为更大的数值。

capabilities.setCapability("newCommandTimeout",240);

比如,最开始使用appium时,设置了上面的安装apk的路径,结果安装后调试程序发现接口无返回数据。后来定位问题是因为安装时进行了重签名。程序的保护机制让数据无返回了。可以使用noSign设置来避免重签名。

capabilities.setCapability("noSign","true");

当然,后来发现不在程序里写文件路径,而是提前安装好测试包,这样就避免了每次都要重新安装。

完整的Server参数

http://appium.io/slate/en/master/?ruby#appium-server-capabilities

**Server capabilities**
Capability           Appium 、Selendroid
platformName         平台的名称:iOS, Android, or FirefoxOS
platformVersion      移动设备的系统版本号,7.1, 4.4
deviceName           IOS:instruments -s devices,Android:随便写
app                  安装文件路径:/abs/path/to/my.apk or http://myapp.com/app.ipa
browserName          测试的web浏览器,如果是测app则忽略
newCommandTimeout    等待新命令的最长时间,超时后退出。默认是60s
autoLaunch           是否自动安装和启动,默认true
language             模拟器的语言设置
locale               模拟器的地区设置
udid                 设备号
orientation          模拟器的横竖屏设置
autoWebview          Move directly into Webview context
noReset              在当前session前不重置app状态
fullReset            ios删除文件夹,Android删除app数据。

**android only**
appActivity                 要启动的Activity
appPackage                  要启动的包
appWaitActivity             等待的Activity
appWaitPackage              等待的包 
deviceReadyTimeout          等待设备就绪的时间
androidCoverage             
enablePerformanceLogging    (Chrome and webview only)default=false
androidDeviceReadyTimeout
androidDeviceSocket
avd
avdLaunchTimeout
avdReadyTimeout
avdArgs
useKeystore
keystorePath
keystorePassword
keyAlias
keyPassword
chromedriverExecutable
autoWebviewTimeout
intentAction
intentCategory
intentFlags
optionalIntentArguments
unicodeKeyboard
resetKeyboard
noSign              Skip checking and signing,work only with UiAutomator and not with selendroid
ignoreUnimportantViews

**ios  only**
calendarFormat
bundleId
udid
launchTimeout
locationServicesEnabled
locationServicesAuthorized
autoAcceptAlerts
nativeInstrumentsLib
nativeWebTap
safariAllowPopups
safariIgnoreFraudWarning
safariOpenLinksInBackground
keepKeyChains
localizableStringsDir
processArguments
interKeyDelay
showIOSLog

TAG:

 

评分:0

我来说两句

Open Toolbar