iOS 测试 WebDriverAgent 简介

恒温 · 2016年05月15日 · 最后由 wanglijing 回复于 2019年06月23日 · 39929 次阅读
本帖已被设为精华帖!

WebDriverAgent 是什么

去年的 SeleniumConf 上,Facebook 推出了一款新的 iOS 移动测试框架 —— WebDriverAgent,当时的推文上,写的还只支持模拟器。半年过过去了,如今在看官方 github —— https://github.com/facebook/WebDriverAgent,已经宣称支持真机测试了(亲测的确支持)。我把它的 ReadMe 搬运过来:

WebDriverAgent 在 iOS 端实现了一个 WebDriver server ,借助这个 server 我们可以远程控制 iOS 设备。你可以启动、杀死应用,点击、滚动视图,或者确定页面展示是否正确。This makes it a perfect tool for application end-to-end testing or general purpose device automation.(它说它是 iOS 上一个完美的 e2e 的自动化解决方案)It works by linking XCTest.framework and calling Apple's API to execute commands directly on a device.(链接XCTest.framework调用苹果的 API 直接在设备上执行命令)WebDriverAgent is developed and used at Facebook for end-to-end testing and is successfully adopted by Appium.(Appium 封装工作正在进行中,如果一旦封装好,那么以后就可以直接用 Appium 提供的 binding 了。)It is currently maintained by Marek Cirkos and Mehdi Mulani.

它有如下特性:

  • 真机和模拟器都支持
  • 实现了大部分的 WebDriver spec
  • USB support for devices,所谓的 usb 支持,指的是设备不需要上网,目前 client binding 还没有。
  • 提供了一个 Inspector
  • Easy development cycle as it can be launched & debugged directly via Xcode
  • Unsupported yet, but works with tvOS & OSX

WebDriverAgent 的使用

To get the project set up just run bootstrap script:

./Scripts/bootstrap.sh

It will:

  • fetch all dependencies with Carthage
  • build Inspector bundle using npm

After it is finished you can simply open WebDriverAgent.xcodeproj and start WebDriverAgentRunner test and start sending requests.

More about how to start WebDriverAgent here.

官方的文档讲的很清晰,基本没有什么坑。Carthage 是用来解决 xcode project 依赖的,大家可能知道 cocoapod,那你就把 Carthage 理解成和 cocoapod 一样的东西就可以了,可以通过 brew install carthage 安装。npm 是用来构建 Inspector, Inspector 是一个 react 的应用,通过往 WebDriverAgent 发 HTTP 请求,返回页面的结构。

下面是我运行 ./Scripts/bootstrap.sh 的结果:

➜  WebDriverAgent git:(master) ./Scripts/bootstrap.sh
Fetching dependencies
*** Checking out KissXML at "5.0.3"
*** Checking out peertalk at "5a0495a7b7d81b68e25ea1933c755b677cb040da"
*** Checking out RoutingHTTPServer at "v1.0.0"
*** Downloading ocmock.framework binary at "OCMock 3.2.2"
*** Checking out ocmock at "v3.2.2"
*** xcodebuild output can be found in /var/folders/11/wh7ypz2s7q17lxxjphxd4z6h0000gn/T/carthage-xcodebuild.XhkH5T.log
*** Building scheme "OCMock iOS" in OCMock.xcodeproj
2016-05-14 17:45:36.012 xcodebuild[14231:270807] [MT] DVTPlugInManager: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for KSImageNamed.ideplugin (com.ksuther.KSImageNamed) not present
2016-05-14 17:45:36.159 xcodebuild[14231:270807] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-05-14 17:45:36.160 xcodebuild[14231:270807] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-05-14 17:45:46.318 xcodebuild[14494:271598] [MT] DVTPlugInManager: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for KSImageNamed.ideplugin (com.ksuther.KSImageNamed) not present
2016-05-14 17:45:46.376 xcodebuild[14494:271598] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-05-14 17:45:46.377 xcodebuild[14494:271598] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
Building Inspector
Creating bundle directory...
Building inspector.js...

> web-driver-inspector@1.0.0 build /Users/lihuazhang/code/WebDriverAgent/Inspector
> webpack --progress --colors

Hash: 536587fce0cad79f8558
Version: webpack 1.12.2
Time: 2794ms
       Asset    Size  Chunks             Chunk Names
inspector.js  706 kB       0  [emitted]  main
   [0] multi main 28 bytes {0} [built]
    + 182 hidden modules
Done
➜  WebDriverAgent git:(master)

build 好之后就是启动 WebDriverAgent,官方提供了四种方式:

  1. 使用 XCode

  2. 用 xcodebuild

  3. Using fbsimctl from FBSimulatorControl framework

  4. Using FBSimulatorControl framework directly

我使用 XCode (如果自动化的话,可以使用 xcodebuild),打开 WebDriverAgent.xcodeproj,IDE 的显示是这样的:

先不要纠结其他,我们只看 UITestingUITests.m,这是一个 XCTestCase 的实现类,我们直接运行,真机或者模拟器都可以。我用的模拟器,运行之后,会在模拟器安装一个 WebDriverAgentRunner 的应用。我们看下运行的日志:

2016-05-15 01:19:43.019 XCTRunner[29300:524372] Running tests...
01:19:43.218 XCTRunner[29300:524495] _XCT_testBundleReadyWithProtocolVersion:minimumVersion: reply received
01:19:43.228 XCTRunner[29300:524495] _IDE_startExecutingTestPlanWithProtocolVersion:16
2016-05-15 01:19:44.732 XCTRunner[29300:524372] Continuing to run tests in the background with task ID 1
Test Suite 'Selected tests' started at 2016-05-15 01:19:45.319
Test Suite 'UITestingUITests' started at 2016-05-15 01:19:45.322
Test Case '-[UITestingUITests testRunner]' started.
2016-05-15 01:19:45.323 XCTRunner[29300:524372] -[_XCTestDriverTestObserver testCaseWillStart:] UITestingUITests testRunner
    t =     0.00s     Start Test
2016-05-15 01:19:45.324 XCTRunner[29300:524372] -[UITestingUITests testRunner] started activity <XCActivityRecord: 0x7f8acb721660> 2016-05-14 17:19:45 +0000: Start Test
2016-05-15 01:19:45.327 XCTRunner[29300:524372] -[UITestingUITests testRunner] finished activity <XCActivityRecord: 0x7f8acb721660> 2016-05-14 17:19:45 +0000: Start Test (0.00271106s)
    t =     0.01s     Set Up
2016-05-15 01:19:45.328 XCTRunner[29300:524372] -[UITestingUITests testRunner] started activity <XCActivityRecord: 0x7f8acb7219e0> 2016-05-14 17:19:45 +0000: Set Up
2016-05-15 01:19:45.330 XCTRunner[29300:524372] -[UITestingUITests testRunner] finished activity <XCActivityRecord: 0x7f8acb7219e0> 2016-05-14 17:19:45 +0000: Set Up (0.00130302s)
2016-05-15 01:19:45.331 XCTRunner[29300:524372] Built at May 15 2016 01:19:32
2016-05-15 01:19:45.386 XCTRunner[29300:524372] ServerURLHere->http://192.168.0.105:8100<-ServerURLHere
2016-05-15 01:19:45.386 XCTRunner[29300:524372] Listening on USB

关键字是:

2016-05-15 01:19:45.386 XCTRunner[29300:524372] ServerURLHere->http://192.168.0.105:8100<-ServerURLHere

这个意思是告诉我们,设备中起了一个服务器,我们可以用 http://192.168.0.105:8100 访问到。下面就是在浏览器打开返回的内容:

{
value: "Unhandled endpoint: / -- http://192.168.0.105:8100/ with parameters { wildcards = ( "" ); }",
sessionId: null,
status: 1
}

通道找到了,接下来就是看如何造请求了。官方问题提供了文档:https://github.com/facebook/WebDriverAgent/wiki/Queries。最简单的 statushttp://192.168.0.105:8100/status

{
value: {
state: "success",
os: {
name: "iPhone OS",
version: "9.3"
},
ios: {
simulatorVersion: "9.3"
},
build: {
time: "May 15 2016 01:19:33"
}
},
sessionId: null,
status: 0
}

其他的 API 有兴趣的人可以直接看文档。

服务端有了,就剩下客户端了,但是目前为止没有一个官方的客户端 binding,Facebook 的同学没有放出来,看这个 issue——https://github.com/facebook/WebDriverAgent/issues/115

所以目前为止如果要使用 WebDriverAgent 就要自己实现一套客户端代码。

WebDriverAgent Inspector 的使用

直接在浏览器端打开 http://192.168.0.105:8100/inspector,就可以看见如下界面:

inspector 不是很强大,无法实现交互,不过大致能帮大家定位元素。

WebDriverAgent 简单原理

总结

WebDriverAgent 取代 UIAutomation 或者 XCUITesting 做为 Appium 底部驱动看来是时间问题了。原因如下:

  1. 支持真机和模拟器

  2. 不受 instruments 单实例的限制

  3. Facebook 出品

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 83 条回复 时间 点赞

不错. 等 appium 去封装实现了. appium 默认的 uiautomation 实现坑略多. 不太稳定. 搞的我截图都只能用 idevice 工具

战略 mark

赞,ios 多设备并行也可以解决了

书读得少 真的只是时间的问题?最终做出来的和发给大家的会是一个版本么?郁闷了

恒温 #95 · 2016年05月16日 Author

#4 楼 @lanxiangtechnical appium 官方已经在整合了。时间问题。关键 ios 多设备并行也可以解决了。

Macaca 已经整合

恒温 #93 · 2016年05月16日 Author

#6 楼 @xdf :plus1: 这么屌?可以单独放出一个 binding 来不?

#5 楼 @lihuazhang 牛逼 年底能帮忙催促下么 争取 2017 年开年红啊

恒温 #91 · 2016年05月16日 Author

#8 楼 @lanxiangtechnical 达峰不是说 macaca 已经整合了么,可以试试。

我踩坑了。。。

$ ./Scripts/bootstrap.sh
Fetching dependencies
*** Checking out KissXML at "5.0.3"
*** Checking out peertalk at "5a0495a7b7d81b68e25ea1933c755b677cb040da"
*** Downloading ocmock.framework binary at "OCMock 3.2.2"
*** Checking out ocmock at "v3.2.2"
*** Checking out RoutingHTTPServer at "v1.0.0"
*** xcodebuild output can be found in /var/folders/k4/f6dh0_b90yj3y3rws3mt7gxr0000gn/T/carthage-xcodebuild.b0AqO1.log
Failed to read file or folder at /Users/hengjiechj/Personal/WebDriverAgent/ocmock/Cartfile: Error Domain=NSCocoaErrorDomain Code=260 "The file “Cartfile” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/hengjiechj/Personal/WebDriverAgent/ocmock/Cartfile, NSUnderlyingError=0x7f8c51e119a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

正在找解决方法。。。

#10 楼 @chenhengjie123 填坑方法:

# 分步走 bootstrap.sh 里面的步骤
$ carthage checkout
*** Checking out KissXML at "5.0.3"
*** Downloading ocmock.framework binary at "OCMock 3.2.2"
*** Checking out peertalk at "5a0495a7b7d81b68e25ea1933c755b677cb040da"
*** Checking out ocmock at "v3.2.2"
*** Checking out RoutingHTTPServer at "v1.0.0"

# 这步从原来的 carthage build ocmock --platform iOS 改为 carthage build --platform iOS
$ carthage build --platform iOS
*** xcodebuild output can be found in /var/folders/k4/f6dh0_b90yj3y3rws3mt7gxr0000gn/T/carthage-xcodebuild.6HnolN.log
*** Skipped building KissXML due to the error:
Dependency "KissXML" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/robbiehanson/KissXML/issues/new
*** Skipped building RoutingHTTPServer due to the error:
Dependency "RoutingHTTPServer" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/mattstevens/RoutingHTTPServer/issues/new
*** Building scheme "OCMock iOS" in OCMock.xcodeproj
*** Skipped building peertalk due to the error:
Dependency "peertalk" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/rsms/peertalk/issues/new
2016-05-16 14:57:40.978 xcodebuild[20598:270057] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XActivatePowerMode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-05-16 14:57:42.707 xcodebuild[20636:270151] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XActivatePowerMode.xcplugin' not present in DVTPlugInCompatibilityUUIDs

# 继续用原有脚本 build inspector
$ ./Scripts/bootstrap.sh -i
Building Inspector
Creating bundle directory...
Building inspector.js...

> web-driver-inspector@1.0.0 build /Users/hengjiechj/Personal/WebDriverAgent/Inspector
> webpack --progress --colors

Hash: 842186d690872be37d64
Version: webpack 1.12.2
Time: 2573ms
       Asset    Size  Chunks             Chunk Names
inspector.js  706 kB       0  [emitted]  main
   [0] multi main 28 bytes {0} [built]
    + 182 hidden modules
Done

另外,分别找了台 iOS 7 和 iOS 9.3 的真机鉴定。基本结论如下:

  1. 在真机上使用的是 XCUITest 框架,不支持 iOS 9.0 以下的设备。
  2. 可以获取到任何界面的元素,包括桌面、系统弹窗:

感觉有点像 Android 的 UIAutomator 。

赞赞赞~

#12 楼 @chenhengjie123 可以支持图片获取吗?

#14 楼 @wenshi11019 你是说获取屏幕截图?可以啊。inspector 就是这么获取到屏幕截图的啊。

看起来很强大的感觉,官方的文档说 appium 已经支持了

#15 楼 @chenhengjie123 不是,我是指应用的 image,因为有些控件是用图片的,appium 是识别不了

#17 楼 @wenshi11019 你说的是自绘控件吧?这个没试过。你有确定用了这类控件的 app 不?我可以装上试试

恒温 #81 · 2016年05月17日 Author

#17 楼 @wenshi11019 自会控件只要正确地实现了 accessiblilty 就可以了。

#18 楼 @chenhengjie123 有啊,试试安装和留言,里面有些控件就是自绘的,获取不了控件的 name,只能用其他方法绕过

#19 楼 @lihuazhang 但如果这些 accessiblilty 会变动呢,就好像 QQ 的消息列表。

#20 楼 @wenshi11019 给个具体界面截图吧?

#22 楼 @chenhengjie123 留言箱界面就是了

何愁没有ClientJMeter不要太方便。Appium 我都用JMeter来当客户端了

恒温 #75 · 2016年05月28日 Author

#24 楼 @watman ...分享下呗,大规模采用 http 请求的自动化测试还没见过。

区曼 [该话题已被删除] 中提及了此贴 07月05日 22:48

#5 楼 @lihuazhang 现在能否实现 ios 多设备并行?

恒温 #70 · 2016年07月24日 Author

#28 楼 @raythan 并行需要你自己实现的。

69楼 已删除

#29 楼 @lihuazhang 你好,webdriveragent 上面有一张图简单原理,我想请教的是,XCTest.framework/Uiautomation.framework,关于这里我有一点疑问,我在 wda 源码里貌似没有看到跟 uiautomation 相关的地方,wda 也是封装了 uiautomation 的吗?我理解的是 wda 采用的是 XCUITesting,应该跟 uiautomation 无关是吗?不知道我是理解的不对还是怎么样,希望您能给点指教。谢谢

adfghzhang [该话题已被删除] 中提及了此贴 08月30日 18:37
66楼 已删除
65楼 已删除

使用 appium 的 inspector

http://192.168.7.29:8100/inspector

报如下错误:

{
"value" : "Invalid parameter not satisfying: path\n\n(\n\t0 CoreFoundation 0x00000001810bae50 + 148\n\t1 libobjc.A.dylib 0x000000018071ff80 objc_exception_throw + 56\n\t2 CoreFoundation 0x00000001810bad08 + 0\n\t3 Foundation 0x0000000181a40124 + 112\n\t4 WebDriverAgentLib 0x0000000102071624 -[FBResponseFilePayload initWithFilePath:] + 284\n\t5 WebDriverAgentLib 0x000000010206d364 FBResponseFileWithPath + 84\n\t6 WebDriverAgentLib 0x000000010207dc3c __29+[FBInspectorCommands routes]_block_invoke + 100\n\t7 WebDriverAgentLib 0x000000010206d684 -[FBRoute_Sync mountRequest:intoResponse:] + 168\n\t8 WebDriverAgentLib 0x0000000102065fb0 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 496\n\t9 RoutingHTTPServer 0x000000010685a3cc -[RoutingHTTPServer handleRoute:withRequest:response:] + 144\n\t10 RoutingHTTPServer 0x000000010685ab80 __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 44\n\t11 libdispatch.dylib 0x0000000180b0547c + 16\n\t12 libdispatch.dylib 0x0000000180b14ae8 + 644\n\t13 libdispatch.dylib 0x0000000180b0547c + 16\n\t14 libdispatch.dylib 0x0000000180b0ab84 _dispatch_main_queue_callback_4CF + 1844\n\t15 CoreFoundation 0x0000000181070dd8 + 12\n\t16 CoreFoundation 0x000000018106ec40 + 1628\n\t17 CoreFoundation 0x0000000180f98d10 CFRunLoopRunSpecific + 384\n\t18 Foundation 0x00000001819a8d8c + 308\n\t19 Foundation 0x00000001819fdff8 + 88\n\t20 WebDriverAgentLib 0x0000000102065030 -[FBWebServer startServing] + 320\n\t21 WebDriverAgentRunner 0x00000001004ebed0 -[UITestingUITests testRunner] + 120\n\t22 CoreFoundation 0x00000001810c0ae0 + 144\n\t23 CoreFoundation 0x0000000180fb8548 + 284\n\t24 XCTest 0x000000010006e0a8 __24-[XCTestCase invokeTest]_block_invoke_2 + 388\n\t25 XCTest 0x00000001000a2c98 -[XCTestContext performInScope:] + 208\n\t26 XCTest 0x000000010006df0c -[XCTestCase invokeTest] + 268\n\t27 XCTest 0x000000010006e5e0 -[XCTestCase performTest:] + 460\n\t28 XCTest 0x000000010006ba5c -[XCTestSuite performTest:] + 428\n\t29 XCTest 0x000000010006ba5c -[XCTestSuite performTest:] + 428\n\t30 XCTest 0x000000010006ba5c -[XCTestSuite performTest:] + 428\n\t31 XCTest 0x0000000100057740 __25-[XCTestDriver _runSuite]_block_invoke + 56\n\t32 XCTest 0x0000000100078260 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 528\n\t33 XCTest 0x00000001000575d8 -[XCTestDriver _runSuite] + 460\n\t34 XCTest 0x00000001000583b4 -[XCTestDriver _checkForTestManager] + 296\n\t35 XCTest 0x00000001000a4164 _XCTestMain + 628\n\t36 CoreFoundation 0x000000018107100c + 20\n\t37 CoreFoundation 0x0000000181070944 + 308\n\t38 CoreFoundation 0x000000018106e8a8 + 708\n\t39 CoreFoundation 0x0000000180f98d10 CFRunLoopRunSpecific + 384\n\t40 GraphicsServices 0x0000000182880088 GSEventRunModal + 180\n\t41 UIKit 0x000000018626df70 UIApplicationMain + 204\n\t42 XCTRunner 0x000000010003c3d4 XCTRunner + 33748\n\t43 libdyld.dylib 0x0000000180b368b8 + 4\n)",
"sessionId" : "03A46A84-D6F5-482C-AF51-96AEA66026DF",
"status" : 13
}

区曼 Ant+JMeter+WebDriverAgent 游记 中提及了此贴 12月22日 14:08

求助~我在安装的时候,最后报错:
Fetching dependencies
Building Inspector
Creating bundle directory...
Fetching Inspector dependencies...
npm WARN react-treeview@0.4.6 requires a peer of react@>=0.14.0 but none was installed.
npm WARN web-driver-inspector@1.0.0 No repository field.
Building Inspector...

web-driver-inspector@1.0.0 build /node_modules/webdriver/WebDriverAgent/Inspector
webpack --progress --colors

Hash: 9ed7d0b85cc08341fd0f

Version: webpack 1.14.0
Time: 74ms
[0] multi main 28 bytes {0} [built] [1 error]
+ 1 hidden modules

ERROR in ./js/app.js
Module parse failed: /node_modules/webdriver/WebDriverAgent/Inspector/js/app.js Unexpected token (59:4)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (59:4)
at Parser.pp$4.raise (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp$3.parseExprAtom (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1822:12)
at Parser.pp$3.parseExprSubscripts (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1692:19)
at Parser.pp$3.parseExprOps (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1597:21)
at Parser.pp$3.parseParenAndDistinguishExpression (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1861:32)
at Parser.pp$3.parseExprAtom (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1796:19)
at Parser.pp$3.parseExprSubscripts (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1692:19)
at Parser.pp$3.parseExprOps (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1597:21)
at Parser.pp$3.parseExpression (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1573:21)
at Parser.pp$1.parseReturnStatement (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:839:33)
at Parser.pp$1.parseStatement (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:699:34)
at Parser.pp$1.parseBlock (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$3.parseFunctionBody (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2105:24)
at Parser.pp$3.parseMethod (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2075:10)
at Parser.pp$1.parseClassMethod (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1137:25)
at Parser.pp$1.parseClass (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1118:14)
at Parser.pp$1.parseStatement (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:697:19)
at Parser.pp$1.parseTopLevel (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule. (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
@ multi main
Done

我用 Xcode 模拟器安装.app 文件时, 会自动安装 webdriveragent, app 也能被安装上 但是一点开就 crash 不知道为什么
真机测试就完全启动不了 Unable to start WebDriverAgent

匿名 #60 · 2016年12月30日

我用真机装的,webdriverAgent 启动后,提示 listening on usb ,我想用手机 IP+ 端口但是访问不了。。。有知道为什么的吗?我就是想用 ip+ 端口去访问,不想通过 usb 访问。

我在页面访问 app 控件元素的时候,浏览器出现如下提示:Safari 无法打开页面 “‎10.69.13.90:8100”,因为此页面所在的服务器未响应,求指教

@chenhengjie123 真机装不上 WebDriverAgent 呢,是签名问题么?试了好几个 id 都不行呢

#42 楼 @lynn_qin 给下报错信息?

@chenhengjie123 error:
[Xcode]
Testing failed:
Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.

[Xcode] Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.2'
TEST FAILED

The following build commands failed:
Check dependencies
(1 failure)
.....
主要错就在这里

[Xcode] Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.2'
TEST FAILED

没有签名。。。

@chenhengjie123 code signing 问题现在解决了,但是现在在卡着不动了:
[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/beyondsoft/Library/Developer/Xcode/DerivedData/WebDriverAgent-cdbymtonqyssjhfwnanxtomfuiox/Logs/Test/CA67A9A7-4B60-42EA-A9E3-604608AA8EFE/Session-WebDriverAgentRunner-2017-01-11_165113-AuhrXW.log
[Xcode] 2017-01-11 16:51:31.436 xcodebuild[99550:3564048] DTDeviceKit: Could not start house arrest service for app identifier com.apple.test.WebDriverAgentRunner-Runner [Error Domain=com.apple.dtdevicekit Code=-402653093 "Too many instances of this service are already running." UserInfo={NSLocalizedFailureReason=Too many instances of this service are already running., com.apple.dtdevicekit.stacktrace=(
0 DTDeviceKitBase 0x00000001159fa37b DTDKCreateNSError + 113
1 DTDeviceKitBase 0x00000001159faab9 DTDK_AMDErrorToNSError + 791
2 DTDeviceKitBase 0x0000000115a0c2a5 __70-[DTDKRemoteDeviceConnection startHouseArrestServiceForAppIdentifier:]_block_invoke + 100
3 DTDeviceKitBase 0x0000000115a0b181 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_4 + 22
4 DTDeviceKitBase 0x00000001159fd2c7 __DTDKExecuteInSession_block_invoke + 38
5 DTDeviceKitBase 0x00000001159fc8f0 __DTDKExecuteWithConnection_block_invoke_2 + 477
6 DTDeviceKitBase 0x00000001159fc6ec __DTDKExecuteWithConnection_block_invoke + 107
7 libdispatch.dylib 0x00007fffda0c6128 _dispatch_client_callout + 8
8 libdispatch.dylib 0x00007fffda0c6d62 _dispatch_barrier_sync_f_invoke + 83
9 DVTFoundation 0x000000010e62695b DVTDispatchBarrierSync + 206
10 DVTFoundation 0x000000010e603307 -[DVTDispatchLock performLockedBlock:] + 116
11 DTDeviceKitBase 0x00000001159fc5f6 DTDKExecuteWithConnection + 223
12 DTDeviceKitBase 0x00000001159fd251 DTDKExecuteInSession + 121
13 DTDeviceKitBase 0x0000000115a0b0b8 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_3 + 117
14 DVTFoundation 0x000000010e625cb7 __DVTDispatchAsync_block_invoke + 827
15 libdispatch.dylib 0x00007fffda0cef5f _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x00007fffda0c6128 _dispatch_client_callout + 8
17 libdispatch.dylib 0x00007fffda0dbc10 _dispatch_continuation_pop + 533
18 libdispatch.dylib 0x00007fffda0d2ea3 _dispatch_async_redirect_invoke + 734
19 libdispatch.dylib 0x00007fffda0c7ee0 _dispatch_root_queue_drain + 476
20 libdispatch.dylib 0x00007fffda0c7cb7 _dispatch_worker_thread3 + 99
21 libsystem_pthread.dylib 0x00007fffda313736 _pthread_wqthread + 1299
22 libsystem_pthread.dylib 0x00007fffda313211 start_wqthread + 13
), NSLocalizedRecoverySuggestion=Too many instances of this service are already running., NSLocalizedDescription=Too many instances of this service are already running.}]

[debug] [WebDriverAgent] Device: Jan 11 16:51:39 iPhone XCTRunner[322] : Running tests...
[debug] [WebDriverAgent] Device: Jan 11 16:51:39 iPhone XCTRunner[322] : Unable to load configuration data from specified path /var/folders/sv/0x5js8lj6k1gbk3gv45k171w0000gn/T/com.apple.dt.XCTest/B4AF29A1-6DE6-48A3-9EB4-C84C4493A9B1/remote-container/tmp/WebDriverAgentRunner-B4AF29A1-6DE6-48A3-9EB4-C84C4493A9B1.xctestconfiguration; error: The file doesn\M-b\M@\MYt exist.
[debug] [WebDriverAgent] Device: Jan 11 16:51:39 iPhone XCTRunner[322] : Looking for test bundles in /var/containers/Bundle/Application/BCEA1CC9-2093-4494-98FF-B8957B96FE19/WebDriverAgentRunner-Runner.app/PlugIns
[debug] [WebDriverAgent] Device: Jan 11 16:51:39 iPhone XCTRunner[322] : Found test bundle at /var/containers/Bundle/Application/BCEA1CC9-2093-4494-98FF-B8957B96FE19/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest
[debug] [WebDriverAgent] Device: Jan 11 16:51:39 iPhone XCTRunner[322] : Looking for configurations in /var/containers/Bundle/Application/BCEA1CC9-2093-4494-98FF-B8957B96FE19/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest
[debug] [WebDriverAgent] Device: Jan 11 16:51:39 iPhone XCTRunner[322] : No configurations found, creating a default configuration that will run all tests.
然后就一直卡在这里- -

出现 #36 楼一样的报错,有知道怎么解决么 用的模拟器 iphone7 iOS10.2 xcode8.2

52楼 已删除

之前的问题已解决,可是无法像楼主你们这样打开 inspector, 直接获取图像化的元素读取, 请问这个怎么实现的

我使用 xcode 8.2 simulator iphone6s iOS 9.3 http://172.30.171.244:8100/inspector 也报错

status source screenshot 这几个是正常的

{
"value" : "Invalid parameter not satisfying: path\n\n(\n\t0 CoreFoundation 0x0000000108a6dd85 __exceptionPreprocess + 165\n\t1 libobjc.A.dylib 0x00000001084e1deb objc_exception_throw + 48\n\t2 CoreFoundation 。。。。。。",
"sessionId" : "27DEE885-7AE8-4412-9218-2420C71AC6AF",
"status" : 13
}

报错日志,看不懂是什么意思
t = 0.00s Start Test at 2017-01-18 14:28:36.426
t = 0.00s Set Up
2017-01-18 14:28:36.429 XCTRunner[2482:99432] Built at Jan 18 2017 11:52:54
2017-01-18 14:28:36.442 XCTRunner[2482:99432] ServerURLHere->http://172.30.171.244:8100<-ServerURLHere
t = 4.06s Find the Application "local.pid.2446" 0x7fec1c861de0
t = 4.06s Snapshot accessibility hierarchy for local.pid.2446
2017-01-18 14:33:16.813 XCTRunner[2482:99432] *** Assertion failure in -[FBResponseFilePayload initWithFilePath:], /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Routing/FBResponseFilePayload.m:24
2017-01-18 14:34:47.425 XCTRunner[2482:99432] *** Assertion failure in -[FBResponseFilePayload initWithFilePath:], /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Routing/FBResponseFilePayload.m:24

#38 楼 @lynn_qin 你好 请问你 38 楼的问题是怎么解决的呢?

#45 楼 @Lihuazhang @chenhengjie123 请问一下我在真机和模拟器上都能运行成功 WebDriverAgent,访问http://172.16.23.2:8100 也显示正常

{
  "value" : "Unhandled endpoint: \/ -- http:\/\/172.16.23.2:8100\/ with parameters {\n    wildcards =     (\n        \"\"\n    );\n}",
  "sessionId" : "AE6BF076-84FD-4C1C-8199-ABD2B3595E86",
  "status" : 1
}

但是访问http://172.16.23.2:8100/inspector的时候浏览器中什么都没显示,没有像上面那样显示树形的页面元素。这是为什么呢?

还有个问题,我运行./Scripts/bootstrap.sh 的时候报错了不知道怎么解决,还请麻烦帮忙看一下

yefengjundeMacBook-Pro:WebDriverAgent yefengjun$ ./Scripts/bootstrap.sh
Fetching dependencies
Building Inspector
Creating bundle directory...
Fetching Inspector dependencies...
npm WARN react-treeview@0.4.6 requires a peer of react@>=0.14.0 but none was installed.
npm WARN web-driver-inspector@1.0.0 No repository field.
Building Inspector...

> web-driver-inspector@1.0.0 build /Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector
> webpack --progress --colors

Hash: 9ed7d0b85cc08341fd0f  
Version: webpack 1.14.0
Time: 71ms
   [0] multi main 28 bytes {0} [built] [1 error]
    + 1 hidden modules

ERROR in ./js/app.js
Module parse failed: /Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/js/app.js Unexpected token (59:4)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (59:4)
    at Parser.pp$4.raise (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:603:10)
    at Parser.pp$3.parseExprAtom (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1822:12)
    at Parser.pp$3.parseExprSubscripts (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1715:21)
    at Parser.pp$3.parseMaybeUnary (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1597:21)
    at Parser.pp$3.parseParenAndDistinguishExpression (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1861:32)
    at Parser.pp$3.parseExprAtom (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1796:19)
    at Parser.pp$3.parseExprSubscripts (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1715:21)
    at Parser.pp$3.parseMaybeUnary (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1597:21)
    at Parser.pp$3.parseExpression (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1573:21)
    at Parser.pp$1.parseReturnStatement (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:839:33)
    at Parser.pp$1.parseStatement (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:699:34)
    at Parser.pp$1.parseBlock (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:981:25)
    at Parser.pp$3.parseFunctionBody (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2105:24)
    at Parser.pp$3.parseMethod (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2075:10)
    at Parser.pp$1.parseClassMethod (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1137:25)
    at Parser.pp$1.parseClass (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1118:14)
    at Parser.pp$1.parseStatement (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:697:19)
    at Parser.pp$1.parseTopLevel (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:638:25)
    at Parser.parse (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:516:17)
    at Object.parse (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:3098:39)
    at Parser.parse (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/webpack/lib/Parser.js:902:15)
    at DependenciesBlock.<anonymous> (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/webpack/lib/NormalModule.js:104:16)
    at DependenciesBlock.onModuleBuild (/Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
 @ multi main
Done

#52 楼 @yefnegjun SyntaxError: Unexpected token (59:4) 看起来是语法错误。你换另一个版本的 wda 试试,或者另外发个帖?

#53 楼 @chenhengjie123 我重新下了个 WebDriverAgent,还是不行同样的问题,然后http://172.16.23.2:8100/inspector也报错了....
另一个版本的 wda 是哪个版本啊?在哪下呢?

@utopia 我情况和你一样请问你怎么解决的?

我下好 WebDriverAgent 后,命令行输入 sh ./Scripts/bootstrap.sh -d 结果如下图:

结果按照简介里的 xcodebuild 方法在模拟机上跑打不开 inspector,报这样的错误:

大神能帮忙看看吗?谢谢

codeskyblue ATX 文档 - iOS 真机如何安装 WebDriverAgent 中提及了此贴 01月23日 13:49

#43 楼 @chenhengjie123 没解决。。。换成 appium-ios-inspector 了。。。

@utopia @xlth1947 我遇到一样的问题,使用真机和模拟器运行 inspector 都提示
Assertion failure in [FBResponseFilePayload initWithFilePath]
请问解决了么

@jmei 我在 9.3.5 系统上有这个问题,10.1.1 上直接卡住了,不会提示开始,没有网址,还没解决

@utopia @xlth1947 我的问题解决了,在浏览器看http://localhost:8100/inspector 不行可以,但
直接./Scripts/bootstrap.sh -i 发现报错

后面我升级了下 node,就好了

@jmei 我这边还是这样模拟器上跑不通,你的 node 版本现在是多少?

#63 楼 @xlth1947 你是从来没跑通过么?我是之前可以的,下载了新的 webdriveragent 之后运行 localhost:8100 可以,但 localhost:8100/inspector 不行,咱俩情况不一样?

恒温 #35 · 2017年02月08日 Author

#63 楼 @xlth1947
#64 楼 @jmei
这帖子的信息都有些老了,可能都变化了。还是以官方的为准吧

@jmei inspector 一直没跑通,status 可以直接 localhost:8100 也可以

33楼 已删除
恒温 #32 · 2017年02月12日 Author

#67 楼 @yefnegjun 贴日志信息不要把公司的内容贴出来。

#68 楼 @Lihuazhang 谢谢提醒...没注意

@Lihuazhang 我在使用真机调试的时候,启动 Test 后报如下错误,请问有遇到类似问题吗?如何解决?

1.场景:使用 Xcode 8.2.1 在 iphone6 真机上调试,系统版本 iOS 10.2.1

2.错误日志:

dyld: Library not loaded: @rpath/XCTest.framework/XCTest
  Referenced from: /var/containers/Bundle/Application/33BB088C-73BC-4C8D-9EE1-D9D6A75C80CF/WebDriverAgentRunner-Runner.app/XCTRunner
  Reason: no suitable image found.  Did find:
    /private/var/containers/Bundle/Application/33BB088C-73BC-4C8D-9EE1-D9D6A75C80CF/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest: code signing blocked mmap() of '/private/var/containers/Bundle/Application/33BB088C-73BC-4C8D-9EE1-D9D6A75C80CF/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest'
    /private/var/containers/Bundle/Application/33BB088C-73BC-4C8D-9EE1-D9D6A75C80CF/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest: code signing blocked mmap() of '/private/var/containers/Bundle/Application/33BB088C-73BC-4C8D-9EE1-D9D6A75C80CF/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest'
陈恒捷 回复

你好,我使用 npm install -g eslint-plugin-import 命令安装之后,提示 unmet peer dependency eslint@2.x-3.x ,eslint-plugin-import requires a peer of eslint to@2.x-3.x but none was installed

卡卡 回复

warning 还是 error ?warning 的话可以暂时不用理会,应该不会影响你的安装。真要解决的话可以看下 https://github.com/eslint/eslint/issues/5833

lynn_qin 回复

你好,我在安装中遇到了和你一样的 Error in ./js/app.js 的问题,请问你是怎么解决的,谢谢

陈恒捷 回复

你好,在请教一下,我在安装中又遇到了这个问题
96
lynn_qin · 2 月前

求助~我在安装的时候,最后报错:
Fetching dependencies
Building Inspector
Creating bundle directory...
Fetching Inspector dependencies...
npm WARN react-treeview@0.4.6 requires a peer of react@>=0.14.0 but none was installed.
npm WARN web-driver-inspector@1.0.0 No repository field.
Building Inspector...

web-driver-inspector@1.0.0 build /node_modules/webdriver/WebDriverAgent/Inspector
webpack --progress --colors
Hash: 9ed7d0b85cc08341fd0f

Version: webpack 1.14.0
Time: 74ms
[0] multi main 28 bytes {0} [built] [1 error]

  • 1 hidden modules

ERROR in ./js/app.js
Module parse failed: /node_modules/webdriver/WebDriverAgent/Inspector/js/app.js Unexpected token (59:4)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (59:4)
at Parser.pp$4.raise (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp$3.parseExprAtom (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1822:12)
at Parser.pp$3.parseExprSubscripts (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1692:19)
at Parser.pp$3.parseExprOps (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1597:21)
at Parser.pp$3.parseParenAndDistinguishExpression (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1861:32)
at Parser.pp$3.parseExprAtom (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1796:19)
at Parser.pp$3.parseExprSubscripts (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1692:19)
at Parser.pp$3.parseExprOps (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1597:21)
at Parser.pp$3.parseExpression (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1573:21)
at Parser.pp$1.parseReturnStatement (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:839:33)
at Parser.pp$1.parseStatement (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:699:34)
at Parser.pp$1.parseBlock (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$3.parseFunctionBody (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2105:24)
at Parser.pp$3.parseMethod (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:2075:10)
at Parser.pp$1.parseClassMethod (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1137:25)
at Parser.pp$1.parseClass (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:1118:14)
at Parser.pp$1.parseStatement (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:697:19)
at Parser.pp$1.parseTopLevel (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule. (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/node_modules/webdriver/WebDriverAgent/Inspector/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
@ multi main
Done

陈恒捷 回复

你好,我还的麻烦问一下,昨天的问题已经解决了,可是又出现了一个新的问题,运行./Scripts/bootstrap.sh 时,出现报错:

web-driver-inspector@1.0.0 build /Users/danjiao/node_modules/.2.5.3@appium-xcuitest-driver/WebDriverAgent/Inspector
webpack --progress --colors

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.resolve has an unknown property 'root'. These properties are valid: object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! web-driver-inspector@1.0.0 build: webpack --progress --colors
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the web-driver-inspector@1.0.0 build script 'webpack --progress --colors'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the web-driver-inspector package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack --progress --colors
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs web-driver-inspector
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls web-driver-inspector
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/danjiao/node_modules/.2.5.3@appium-xcuitest-driver/WebDriverAgent/Inspector/npm-debug.log

webpack.config.js 文件是这样的
var path = require('path');

var webpack = require('webpack');

function buildOutputDir() {
return (process.env.BUILD_OUTPUT_DIR != null ? process.env.BUILD_OUTPUT_DIR : __dirname);
}

module.exports = {

entry: [
"./js/app.js"
],
output: {
path: buildOutputDir(),
filename: "inspector.js"
},
module: {
loaders: [
{ test: /.js?$/, loaders: ['babel-loader']},
{ test: /.css?$/, loader: 'style-loader! css-loader' },
]
},
resolve: {
root: path.resolve(__dirname, ''),
},
plugins: [
new webpack.NoErrorsPlugin()
]
};

我这 wda 真机测试启动 app 失败 能帮忙看下嘛?

debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.shenqihudong.game.yycs","arguments":[],"environment":{},"shouldWaitForQuiescence":true}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"6C76A6BD-F273-4326-8837-50BCED74E9DB","value":"Failed to launch com.shenqihudong.game.yycs application","status":13}
[debug] [XCUITest] Failed to create WDA session. Retrying...```

wda 获取到 ip 地址后,通过浏览器打开http://192.168.32.205:8100/status,发现打不开,请问是什么原因呢

songz 回复

你好,请问你的 iOS 并行测试是怎么解决的啊?我这修改了端口,但是不成功啊

大家好,请问谁遇到过这个问题吗,有什么解决办法吗?众人拾柴火焰高,期待有人回复,感谢感谢!admindeMacBook-Pro-3:WebDriverAgent admin$ sh ./Scripts/bootstrap.sh -d
-e Fetching dependencies
*** Cloning peertalk
*** Checking out peertalk at "v1.0"
*** Cloning peertalk
*** Downloading RoutingHTTPServer.framework binary at "v1.0.1"
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/marekcirkos/peertalk.git /Users/admin/Library/Caches/org.carthage.CarthageKit/dependencies/peertalk) failed with exit code 128:
fatal: could not read Username for 'https://github.com:' terminal prompts disabled

小鱼 回复

@chenhengjie123 @Lihuazhang 两位前辈帮忙看看小白的这个问题,感谢感谢!admindeMacBook-Pro-3:WebDriverAgent admin$ sh ./Scripts/bootstrap.sh -d
-e Fetching dependencies
*** Cloning peertalk
*** Checking out peertalk at "v1.0"
*** Cloning peertalk
*** Downloading RoutingHTTPServer.framework binary at "v1.0.1"
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/marekcirkos/peertalk.git /Users/admin/Library/Caches/org.carthage.CarthageKit/dependencies/peertalk) failed with exit code 128:
fatal: could not read Username for 'https://github.com:' terminal prompts disabled

匿名 #15 · 2017年07月27日
chen.zhou 回复

运行 ./Scripts/bootstrap.sh 的结果:

不知道该怎么解决啊

王先生 回复

也遇到这个问题了,在猜想是不是因为升级了 mac 系统到 beta 版,xcode 也升级到最新了

王先生 回复

你好,这个问题解决了吗?

测试小书童 Mac 如何使用命令方式启动 Inspector? 中提及了此贴 11月27日 09:59



我这边 inspector 打开时会报这样的错误,然后上面看不到元素,能帮小弟解决一下这个问题吗?

匿名 #7 · 2018年04月20日

使用http://localhost:8100/inspector在网页中显示空白,
但是http://localhost:8100/status打开是有返回值的
使用 xcode8.3,ios10.3,不知道大家有遇到一样的问题的么

我打开浏览器 inspector 显示全是代码,没有页面😭,怎么办啊,不知道怎么解决

mac10.14 +iOS12, 使用 inspector 无法手机屏幕元素,求指导

opentest-oper@360.cn 专栏文章:WebDriverAgent 与 Minicap 在 ios 真机远控上的应用实践 中提及了此贴 03月01日 14:53
听雪 WebDriverAgent 真机安装教程 中提及了此贴 06月18日 18:04
deepwater 回复

请问你的问题解决了吗

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册