Appium iPhone has denied the launch request.

醋精测试媛 · 2021年05月17日 · 最后由 cmlanche 回复于 2021年05月25日 · 5803 次阅读

1.有看到关于这个问题的解释 (https://testerhome.com/topics/16353) ,原因是 Xcode 版本太高,这是 appium 的一个 bug ,但是 1.12.1 已解决这个 bug,但是我的 appium desktop 版本是 1.2.0-beta.1,应该也是没有这个 bug 的?

  • appium desktop 1.2.0-beta.1
  • xcode 10.1
  • mac 10.14

2.新增问题:
下载完 Carthage,并且 clone 了 Webagentdriver 后,执行:sh .Script/bootstrap.sh,却出现了以下错误,这是什么原因?

dyld: Symbol not found: _$s11SubSequenceSlTl
Referenced from: /usr/local/bin/carthage
Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
in /usr/local/bin/carthage
./Scripts/bootstrap.sh: line 45: 11664 Abort trap: 6           carthage bootstrap $USE_SSH

我有搜过,但是没有搜到和我的错误,另外,将 bootstrap.sh 代码中的!删掉就没事了。

if ! cmp -s Cartfile.resolved Carthage/Cartfile.resolved; then
   carthage bootstrap $USE_SSH
   cp Cartfile.resolved Carthage
fi

但是后续编译问题很多,比如 “'RoutingHTTPServer/RoutingConnection.h' file not found” 等等,网上都说是 Carthage 没下载,但是我下载了。

已解决,这个是 mac 10.14 的坑,下载并安装 “Download Swift 5 Runtime Support for Command Line Tools” 即可

3.WDA 安装和用 xcode test 时出错:

WebDriverAgentRunner-Runner.app encountered an error (Failed to install or launch the test runner. (Underlying error: Unable to launch com.apple.test.WebDriverAgentRunner-Runner. (Underlying error: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier 'com.apple.test.WebDriverAgentRunner-Runner')))

如果 pycharm 运行 driver.remote 会出错

E       *** If you believe this error represents a bug, please attach the result bundle at /Users/gingerbread_man/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Logs/Test/Test-WebDriverAgentRunner-2021.05.18_00-28-28--0700.xcresult
E       2021-05-18 00:28:28.888 xcodebuild[16053:181868] [MT] IDETestOperationsObserverDebug: 0.081 elapsed -- Testing started completed.
E       2021-05-18 00:28:28.890 xcodebuild[16053:181868] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
E       2021-05-18 00:28:28.890 xcodebuild[16053:181868] [MT] IDETestOperationsObserverDebug: 0.081 sec, +0.081 sec -- end
E       2021-05-18 00:28:28.893 xcodebuild[16053:181868] Error Domain=NSCocoaErrorDomain Code=260 "The file “WebDriverAgentRunner-Runner.app” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/gingerbread_man/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7f97868eb150 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
E       2021-05-18 00:28:28.895 xcodebuild[16053:181868] Error Domain=IDETestOperationsObserverErrorDomain Code=4 "Failed to install or launch the test runner" UserInfo={NSLocalizedRecoverySuggestion=If you believe this error represents a bug, please attach the result bundle at /Users/gingerbread_man/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Logs/Test/Test-WebDriverAgentRunner-2021.05.18_00-28-28--0700.xcresult, NSLocalizedDescription=Failed to install or launch the test runner, NSUnderlyingError=0x7f97868ccbf0 {Error Domain=NSCocoaErrorDomain Code=260 "The file “WebDriverAgentRunner-Runner.app” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/gingerbread_man/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7f97868eb150 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}}}
E       Testing failed:
E           Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor. (in target 'WebDriverAgentRunner')
E           The test runner encountered an error (Failed to install or launch the test runner. (Underlying error: The file “WebDriverAgentRunner-Runner.app” couldn’t be opened because there is no such file. The file doesn’t exist. (Underlying error: The operation couldn’t be completed. No such file or directory)))
E       ** TEST EXECUTE FAILED **
E       Testing started on 'iPhone'. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.

/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException

我用 xcode 执行 test 之后变成了这个 bug

iPhone has denied the launch request.

iPhone 上面已经有 webdriveragentrunner app 安装了,但是好像无法启动?

请求大家帮帮忙,我弄了很久没解决。

共收到 23 条回复 时间 点赞

除了将 xcode 降级,没有别的方法了吗

Jonathan #2 回复

多谢!!发现可行,因为在 github 上下的,以为是最新版本,原来有更新的

第二个问题有人遇到过吗

如果用的是最近的版本,不需要执行./Script/bootstrap.sh

Jacc #5 回复

不是最近的版本,第二个问题已经解决了,谢谢。

请问第三个问题大家知道怎么解决吗,今天弄了一天了

iPhone 上面已经有 webdriveragentrunner app 安装了,但是好像无法启动?

看下 iPhone 的日志输出,看有什么报错?

另外,你用 xcode 界面启动 wda ,有启动成功么?(启动成功会看到在 running ,并且 xcode 底部有应用日志打印)

陈恒捷 #9 回复

谢谢,模拟机可以启动,但是 iPhone 不能启动,直接是 “test failed”,错误提示即"iPhone has denied the launch request.",使用了网上的一些方法,比如设置 edit scheme→ 'Info' → Executable → Ask on Launch,或者在钥匙串中清除证书之类的,都没有用,但是后来试了一下模拟机,是可以用的。

PS:我用的是黑苹果,ios 真机是 12.5.2 的,模拟机是 12.1 的

1、iPhone 是装上了 wda 但不能启动,还是连 wda 都装不上?
2、装上了不能启动,iOS 系统日志里应该会有更详细的错误信息,是否有抓取查看过?(用 mac 自带的 控制台 ,设备悬着那台 iOS 设备,就可以看到了)

模拟器相比真机,一些校验是会被省略掉的(比如应用签名校验),所以模拟器能起来,说明程序本身没问题,出问题的应该是在你的配置上。

陈恒捷 #11 回复

1.xcode 构建成功 -》安装 wda 成功 -》launch wda(失败!) 最后的结果:test failed
2.只看过用终端运行 xcode 后的日志:

①
WebDriverAgentRunner-Runner.app encountered an error 
(Failed to install or launch the test runner.
 (Underlying error: Unable to launch com.apple.test.WebDriverAgentRunner-Runner.
 (Underlying error: The operation couldn’t be completed. 
(FBSOpenApplicationErrorDomain error 1.) : 
Failed to launch process with bundle identifier 'com.apple.test.WebDriverAgentRunner-Runner')))

②
WebDriverAgentRunner-Runner.app encountered an error 
(Failed to install or launch the test runner.
(Underlying error: Unable to launch com.apple.test.WebDriverAgentRunner-Runner. 
(Underlying error: The operation couldn’t be completed. Unable to launch com.apple.test.WebDriverAgentRunner-Runner because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user. : 
Failed to launch process with bundle identifier 'com.apple.test.WebDriverAgentRunner-Runner'))

这两种都出现过,我现在 iPhone 被收走了,明天后天会看看您说的日志。

because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.

看这个错误,应用应该是安装了, 只是签名证书没有信任,在设置里面找找看,忘记具体在哪个地方了;

幺叁叁 #13 回复

谢谢,我在钥匙串里面的信任了证书的凭证(由于他一直在生成凭证,所以证书真的很多,我信任了时间比较靠近的一个),但是没有用,请问是要信任所有的证书?

你用的哪种证书签名的?
这个错是 iOS 系统给的,不是 macos,和钥匙串无关。能打出包就和 macos 没什么关系了。

把手机上的 wda 先卸载掉,在 test 呢

是手机上的,你手机上找到 WebDriverAgentRunner 这个应用点击下,会有提示


使用 xcode 运行 test 时出现上面这个错误
手机打开设置 - 通用-描述文件与设备管理 ,信任开发者证书,重新运行,成功

怎么不用tidevice来摆脱对 xcode 的依赖

陈恒捷 #15 回复

就是免费的个人账号申请的证书,我想我知道原因了。

应该是因为黑苹果 mac 版本比较低,导致 xcode 只能用比较低的版本,实际上这个版本是不能兼顾 iPhone 12.1 以上版本的,但是我用了网上的真机调试包,将 xcode 包内容的 device support 包里面添加了 iPhone 12.5,所以后面出了问题。

昨天用比较高版本的 mac 本试了一下,是可以用的。

幺叁叁 #18 回复

谢谢,这个方法多次出现在百度中,我也做了这个步骤,但是还是不行,原因应该是 xcode 版本不兼容 iPhone 版本。

cmlanche #19 回复

今天看了一下,确实不错,不知是否稳定?我后面会试试的,谢谢!

挺稳定的

需要 登录 後方可回應,如果你還沒有帳號按這裡 注册