appium-xcuitest新增功能&遗留问题汇总

本文档详述了使用Appium进行iOS自动化测试时遇到的问题及解决方案,包括模拟器和真实设备上的测试流程、环境配置、常见问题排除方法以及如何通过调整capabilities属性优化测试过程。

失效的功能:

  1. Setting geo location (https://github.com/appium/appium/issues/6856):无法获取屏幕大小
  2. Auto accepting/dismissing alerts (https://github.com/appium/appium/issues/6863):自动关闭弹窗(alerts)失效
  3. Touch Actions:touch操作不能使用

已知问题:

  1. click功能异常
  2. 摇一摇功能未实现(因苹果不支持了)
  3. 锁屏功能不支持
  4. 设置当前定位功能未实现
  5. zoom支持,pinch不支持

模拟器状态重置功能:

By default, this driver will create a new iOS simulator and run tests on it, deleting the simulator afterward.

默认情况下,会新建一个iOS模拟器然后在上面跑case,跑完后会删除该模拟器。

If you specify a specific simulator using the udid capability, this driver will boot the specified simulator and shut it down afterwards.

如果你通过udid属性指定一个特定的模拟器,该driver会启动该模拟器,最后关闭它。

If a udid is provided and the simulator is already running, this driver will leave it running after the test run.

如果提供udid的设备已经在执行自动化了,该driver会等它跑完后再跑。

In short, this driver tries to leave things as it found them.

一句话说,该driver尽量保证模拟器保持其初始状态。

You can use the noReset capability to adjust this behavior. Setting noReset to true will leave the simulator running at the end of a test session.

你可以使用noReset属性来适应这个情况。设置noReset值为true可以等模拟器跑完测试线程后再执行其他内容。

真机调试:

环境配置详见(https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md

已知问题:真机上多次运行失败后,可能不能再建立连接了,补救办法:capability中useNewWDA值为true

其他问题:在真机上跑测试很奇怪,如果停止响应,最常用的解决方法是重启手机,这种情况的log通常展示如下:

真机的签名设置:

在某些系统上会有accessbility限制导致WDA不能运行。这通常会在xcodebuild中返回标注65的错误。解决方法是使用一个不存储在系统钥匙链中的签名,详见(https://github.com/appium/appium/issues/6955http://stackoverflow.com/questions/16550594/jenkins-xcode-build-works-codesign-fails

导出签名,使用命令行:

security create-keychain -p [keychain_password] MyKeychain.keychain
security import MyPrivateKey.p12 -t agg -k MyKeychain.keychain -P [p12_Password] -A
(将MyPrivateKey.p12替换为从系统钥匙链导出来的个人开发者key)
使用keychainPath属性可以将这个钥匙链的路径发送给appium;使用keychainPassword属性可以将这个钥匙链的密码发送给appium。

 

参照:https://github.com/appium/appium-xcuitest-driver

附capabilities属性列表

Capability
Description
Values
noReset Do not destroy or shut down sim after test. Start tests running on whichever sim is running, or device is plugged in. Default false truefalse
processArguments Process arguments and environment which will be sent to the WebDriverAgent server. { args: ["a", "b", "c"] , env: { "a": "b", "c": "d" } } or '{"args": ["a", "b", "c"], "env": { "a": "b", "c": "d" }}'
wdaLocalPort This value if specified, will be used to forward traffic from Mac host to real ios devices over USB. Default value is same as port number used by WDA on device. e.g., 8100
showXcodeLog Whether to display the output of the Xcode command used to run the tests. If this is true, there will be lots of extra logging at startup. Defaults to false e.g., true
iosInstallPause Time in milliseconds to pause between installing the application and starting WebDriverAgent on the device. Used particularly for larger applications. Defaults to 0 e.g., 8000
xcodeOrgId Apple developer team identifier string. Must be used in conjunction with xcodeSigningId to take effect. e.g., JWL241K123
xcodeSigningId String representing a signing certificate. Must be used in conjunction with xcodeOrgId. This is usually just iPhone Developer, so the default (if not included) is iPhone Developer e.g., iPhone Developer
xcodeConfigFile Full path to an optional Xcode configuration file that specifies the code signing identity and team for running the WebDriverAgent on the real device. e.g., /path/to/myconfig.xcconfig
updatedWDABundleId Bundle id to update WDA to before building and launching on real devices. This bundle id must be associated with a valid provisioning profile. e.g., io.appium.WebDriverAgentRunner
keychainPath Full path to the private development key exported from the system keychain. Used in conjunction with keychainPassword when testing on real devices. e.g., /path/to/MyPrivateKey.p12
keychainPassword Password for unlocking keychain specified in keychainPath. e.g., super awesome password
scaleFactor Simulator scale factor. This is useful to have if the default resolution of simulated device is greater than the actual display resolution. So you can scale the simulator to see the whole device screen without scrolling. Acceptable values are: '1.0', '0.75', '0.5', '0.33' and '0.25'. The value should be a string.
usePrebuiltWDA Skips the build phase of running the WDA app. Building is then the responsibility of the user. Only works for Xcode 8+. Defaults to false. e.g., true
preventWDAAttachments Sets read only permissions to Attachments subfolder of WebDriverAgent root inside Xcode's DerivedData. This is necessary to prevent XCTest framework from creating tons of unnecessary screenshots and logs, which are impossible to turn off using programming interfaces provided by Apple. Setting the capability to truewill set Posix permissions of the folder to 555 and falsewill reset them back to 755true by default
webDriverAgentUrl If provided, Appium will connect to an existing WebDriverAgent instance at this URL instead of starting a new one. e.g., http://localhost:8100
useNewWDA If true, forces uninstall of any existing WebDriverAgent app on device. This can provide stability in some situations. Defaults to false. e.g., true
wdaLaunchTimeout Time, in ms, to wait for WebDriverAgewnt to be pingable. Defaults to 60000ms. e.g., 30000
wdaConnectionTimeout Timeout, in ms, for waiting for a response from WebDriverAgent. Defaults to 240000ms. e.g., 1000
resetOnSessionStartOnly Whether to perform reset on test session finish (false) or not (true). Keeping this variable set to true and Simulator running (the default behaviour since version 1.6.4) may significantly shorten the duratiuon of test session initialization. Either true or false. Defaults to true
commandTimeouts Custom timeout(s) in milliseconds for WDA backend commands execution. This might be useful if WDA backend freezes unexpectedly or requires too much time to fail and blocks automated test execution. The value is expected to be of type string and can either contain max milliseconds to wait for each WDA command to be executed before terminating the session forcefully or a valid JSON string, where keys are internal Appium command names (you can find these in logs, look for "Executing command 'command_name'" records) and values are timeouts in milliseconds. You can also set the 'default' key to assign the timeout for all other commands not explicitly enumerated as JSON keys. '120000''{"findElement": 40000, "findElements": 40000, "setValue": 20000, "default": 120000}'
wdaStartupRetries Number of times to try to build and launch WebDriverAgent onto the device. Defaults to 2. e.g., 4
wdaStartupRetryInterval Time, in ms, to wait between tries to build and launch WebDriverAgent. Defaults to 10000ms. e.g., 20000
connectHardwareKeyboard Set this option to true in order to enable hardware keyboard in Simulator. It is set to false by default, because this helps to workaround some XCTest bugs. true or false
maxTypingFrequency Maximum frequency of keystrokes for typing and clear. If your tests are failing because of typing errors, you may want to adjust this. Defaults to 60 keystrokes per minute. e.g., 30
simpleIsVisibleCheck Use native methods for determining visibility of elements. In some cases this takes a long time. Setting this capability to false will cause the system to use the position and size of elements to make sure they are visible on the screen. This can, however, lead to false results in some situations. Defaults to false, except iOS 9.3, where it defaults to true. e.g., truefalse
useCarthageSsl Use SSL to download dependencies for WebDriverAgent. Defaults to false e.g., true
shouldUseSingletonTestManager Use default proxy for test management within WebDriverAgent. Setting this to falsesometimes helps with socket hangup problems. Defaults to true. e.g., false
startIWDP Set this to true if you want to start ios_webkit_debug proxy server automatically for accessing webviews on iOS. The capatibility only works for real device automation. Defaults to false. e.g., true
allowTouchIdEnroll Set this to true if you want to enroll simulator for touch id. Defaults to false. e.g., true

 

 

 

 

 

 

 

 

 

 

 

 

 

<think>好的,我现在需要帮用户查看Appium v2.0.0-rc.2的启动日志、调试模式的信息,以及uiautomator2和xcuitest驱动和插件的相关信息。首先,用户提到了启动日志的位置,根据引用[1],Appium的日志可能存放在/tmp下的某个路径,但具体路径可能因安装方式不同而变化。用户可能需要知道如何通过命令行参数来指定日志位置或者直接查看默认路径。 然后是调试模式,通常Appium可以通过--log-level参数来设置日志级别,比如--log-level debug来启用详细日志输出。这需要提醒用户在启动Appium时加上这个参数,同时可能需要指导他们如何找到生成的日志文件。 接下来关于驱动程序和插件,用户提到了uiautomator2和xcuitestAppium 2.0之后采用了插件架构,需要单独安装驱动。引用[2]和[3]提到了chromedriver的路径设置,这可能与用户的问题相关,但用户的问题是关于uiautomator2和xcuitest的。需要说明如何查看已安装的驱动和插件,使用appium driver list和appium plugin list命令。 另外,用户可能需要知道如何安装这些驱动,比如使用appium driver install uiautomator2和appium driver install xcuitest。同时,启动时需要指定驱动,使用--driver参数。需要确保用户清楚这些步骤,并检查是否已正确安装。 最后,用户的问题可能涉及路径配置或版本兼容性问题,比如chromedriver的版本与设备Chrome版本的匹配,这在引用[2]和[3]中提到了chromedriver的路径设置,需要提醒用户注意版本匹配,避免出现兼容性问题。 总结回答的结构应该是分步骤说明如何启用调试日志、如何查看驱动和插件信息,以及相关的注意事项,如路径和版本问题。同时,引用提供的参考信息来支持回答的正确性。</think>### 查看Appium v2.0.0-rc.2启动日志及驱动信息 #### 1. **启动日志查看** - **调试模式启动** 通过命令行添加`--log-level debug`参数启动Appium,可输出详细日志: ```bash appium --log-level debug ``` 日志默认路径为`/tmp/appium.log`[^1],但具体路径可能因安装方式不同而变化。 - **日志路径自定义** 使用`--log`参数指定日志文件路径: ```bash appium --log /path/to/custom.log ``` #### 2. **驱动与插件信息** - **查看已安装驱动** 执行命令列出所有已安装的驱动: ```bash appium driver list ``` 输出示例: ``` ✔ uiautomator2@2.29.3 ✔ xcuitest@4.9.0 ``` - **查看已安装插件** 执行命令列出所有插件: ```bash appium plugin list ``` #### 3. **指定驱动启动** - **Android (uiautomator2)** 启动时需显式指定驱动: ```bash appium --driver uiautomator2 ``` - **iOS (xcuitest)** 启动命令: ```bash appium --driver xcuitest ``` #### 4. **关键依赖路径** - **chromedriver路径** 若使用WebView测试,需确保`chromedriver`路径正确配置。例如: ``` chromedriver路径示例:/opt/nodejs/lib/node_modules/macaca-chrome/.../chromedriver[^3] ``` 需在Appium配置中指定`chromedriverExecutable`参数[^2]。 #### 5. **常见问题** - **日志权限问题** 若日志写入失败,检查`/tmp/`目录权限或改用用户目录路径。 - **驱动未安装** 通过命令安装缺失驱动: ```bash appium driver install uiautomator2 appium driver install xcuitest ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值