Appium iOS 自动化测试,appium 报错错误 [debug] [XCUITest] Connection to WDA timed out [debug] [iProxy] recv failed: Operation not permitted

yanjiao · 2019年03月13日 · 最后由 yanjiao 回复于 2019年03月14日 · 2198 次阅读

appium +java,在 iOS 自动化测试运行中查找元素出现失败,提示 [debug] [XCUITest] Connection to WDA timed out [debug] [iProxy] recv failed: Operation not permitted,完整错误日志如下

[HTTP] --> POST /wd/hub/session/6706d45a-af46-4355-9a12-52225dcf5968/element
[HTTP] {"using":"accessibility id","value":"确定"}
[debug] [W3C] Calling AppiumDriver.findElement() with args: ["accessibility id","确定","6706d45a-af46-4355-9a12-52225dcf5968"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/8C6D0C86-2D91-468C-9D82-5A6F8D4F999A/element] with body: {"using":"accessibility id","value":"确定"}
[debug] [XCUITest] Log file for xcodebuild test: /Users/jyj/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/Test-WebDriverAgentRunner-2019.03.12_22-01-18-+0800.xcresult/2_Test/Diagnostics/WebDriverAgentRunner-9C0F5436-A76F-46A5-B02A-83992CE32383/WebDriverAgentRunner-7B091DD9-CDF4-4077-A0E5-4B4F69CE7BEA/Session-WebDriverAgentRunner-2019-03-12_225451-KwPq0a.log
[debug] [XCUITest] Connection to WDA timed out
[debug] [iProxy] recv failed: Operation not permitted
[HTTP] <-- POST /wd/hub/session/6706d45a-af46-4355-9a12-52225dcf5968/element 500 11302 ms - 164
[HTTP] 

Session-WebDriverAgentRunner-2019-03-12_225451-KwPq0a.log 错误内容如下

22:55:32.970 WebDriverAgentRunner-Runner[2937:610721] Finished loading test suite, took 0.124s
22:55:32.971 WebDriverAgentRunner-Runner[2937:610721] Running suite...
Test Suite 'Selected tests' started at 2019-03-12 22:55:32.971
22:55:32.972 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testSuiteWillStart:]
22:55:13.477 xcodebuild[31009:2134573] _XCT_testSuite:Selected tests didStartAt:2019-03-12 14:55:32 +0000
Test Suite 'WebDriverAgentRunner.xctest' started at 2019-03-12 22:55:32.975
22:55:32.976 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testSuiteWillStart:]
22:55:13.480 xcodebuild[31009:2134573] _XCT_testSuite:WebDriverAgentRunner.xctest didStartAt:2019-03-12 14:55:32 +0000
Test Suite 'WebDriverAgentRunner.xctest' failed at 2019-03-12 22:55:32.978.
     Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.003) seconds
22:55:32.978 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testSuiteDidFinish:]
22:55:13.483 xcodebuild[31009:2134573] _XCT_testSuite:WebDriverAgentRunner.xctest didFinishAt:2019-03-12 14:55:32 +0000 runCount:1 withFailures:1 unexpected:0 testDuration:0 totalDuration:0.002586007118225098
Test Suite 'WebDriverAgentLib.framework' started at 2019-03-12 22:55:32.981
22:55:32.981 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testSuiteWillStart:]
22:55:13.486 xcodebuild[31009:2134573] _XCT_testSuite:WebDriverAgentLib.framework didStartAt:2019-03-12 14:55:32 +0000
Test Suite 'WebDriverAgentLib.framework' passed at 2019-03-12 22:55:32.984.
     Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.003) seconds
22:55:32.985 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testSuiteDidFinish:]
22:55:13.490 xcodebuild[31009:2134573] _XCT_testSuite:WebDriverAgentLib.framework didFinishAt:2019-03-12 14:55:32 +0000 runCount:0 withFailures:0 unexpected:0 testDuration:0 totalDuration:0.002885937690734863
Test Suite 'Selected tests' failed at 2019-03-12 22:55:32.988.
     Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.017) seconds
22:55:32.989 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testSuiteDidFinish:]
22:55:13.494 xcodebuild[31009:2134573] _XCT_testSuite:Selected tests didFinishAt:2019-03-12 14:55:32 +0000 runCount:1 withFailures:1 unexpected:0 testDuration:0 totalDuration:0.0166250467300415
22:55:32.992 WebDriverAgentRunner-Runner[2937:610721] Finished running suite.
22:55:32.992 WebDriverAgentRunner-Runner[2937:610721] -[XCTRunnerIDESession testBundleDidFinish:

请教有人遇到么,怎么解决呢,每次都在相同位置出现此类错误

共收到 3 条回复 时间 点赞

如果换一种 locator 也报错吗?

就是说 driver.find_element_by_accessibility_id('确定') 定位不到这个元素,换种查找方式再试试吧,比如 xpath

@ 山姆 @ 小薇说测试 谢谢回答,确实定位不到元素,但我用楼 try,catch 将异常捕获掉了,找不到应该进行下一次查找,不知道为什么就提示 Connection to WDA timed out

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