问题描述

公司的 app ,操作 feed 流元素就不行,提示元素不可见。使用 appium 自带的 wda 出现该问题;使用 facebook 的 wda 没问题,但是出现另一个错误不能滑动
## 报错信息
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error Domain=com.facebook.WebDriverAgent Code=1 "The element '"(titleLabel)" StaticText' is not visible on the screen and thus is not interactable" UserInfo={NSLocalizedDescription=The element '"(titleLabel)" StaticText' is not visible on the screen and thus is not interactable}

环境

Appium version :1.9.1
Desktop OS/version used to run Appium: macOS 10.14
Node.js version: 8.10.0
Mobile platform/version under test: iOS11.4.1
Real device or emulator/simulator: Real Device

appium log

[BaseDriver] Event 'newSessionRequested' logged at 1541504172437 (19:36:12 GMT+0800 (CST))
[Appium] Creating new XCUITestDriver (v2.94.2) session
[Appium] Capabilities:
[Appium] platformName: iOS
[Appium] app: cn.xiaochuankeji.tieba-ih
[Appium] platformVersion: 11.4.1
[Appium] deviceName: testphone
[Appium] automationName: XCUITest
[Appium] udid: 48b92f5466bb72c7b00462eea82fb2b7de976a1d
[Appium] newCommandTimeout: 300
[Appium] xcodeOrgId: xxxxxxxxxxxxxxxxxxxxxxxxxxx
[Appium] xcodeSigningId: iPhone Developer
[BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"app":"cn.xiaochuankeji.ti... were provided
[BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[BaseDriver] Session created with session id: b1652ae3-b4ed-440f-bea8-160a6af16a7f
[XCUITest] Current user: 'wangzhen'
[XCUITest] Xcode version set to '10.0'
[XCUITest] iOS SDK Version set to '12.0'
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1541504173088 (19:36:13 GMT+0800 (CST))
[XCUITest] Available devices: 48b92f5466bb72c7b00462eea82fb2b7de976a1d
[XCUITest] Creating iDevice object with udid '48b92f5466bb72c7b00462eea82fb2b7de976a1d'
[XCUITest] Determining device to run tests on: udid: '48b92f5466bb72c7b00462eea82fb2b7de976a1d', real device: true
[XCUITest] App is an iOS bundle, will attempt to run as pre-existing
[BaseDriver] Event 'appConfigured' logged at 1541504174087 (19:36:14 GMT+0800 (CST))
[BaseDriver] Event 'resetStarted' logged at 1541504174087 (19:36:14 GMT+0800 (CST))
[XCUITest] Reset: running ios real device reset flow
[BaseDriver] Event 'resetComplete' logged at 1541504174087 (19:36:14 GMT+0800 (CST))
[iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[iOSLog] Starting iOS device log capture with: 'idevicesyslog'
[XCUITest] Crash reports root '/Users/wangzhen/Library/Logs/CrashReporter/MobileDevice/iPhone6splus 黑' does not exist. Got nothing to gather.
[BaseDriver] Event 'logCaptureStarted' logged at 1541504174441 (19:36:14 GMT+0800 (CST))
[XCUITest] Setting up real device
[XCUITest] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[JSONWP Proxy] Matched '/status' to command name 'getStatus'
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n \"state\" : \"success\",\n \"os\" : {\n \"name\" : \"iOS\",\n \"version\" : \"11.4.1\",\n \"sdkVersion\" : \"12.0\"\n },\n \"ios\" : {\n \"simulatorVersion\" : \"11.4.1\",\n \"ip\" : \"192.168.8.208\"\n },\n \"build\" : {\n \"time\" : \"Nov 6 2018 10:49:44\",\n \"productBundleIdentifier\" : \"com.facebook.WebDriverAgentRunner\"\n }\n },\n \"sessionId\" : \"D7FADEC2-1743-496C-99E0-2BE858CB68C2\",\n \"status\" : 0\n}"
[XCUITest] Upgrade timestamp of the currently bundled WDA: 1541489034073
[XCUITest] Upgrade timestamp of the WDA on the device: undefined
[XCUITest] Will reuse previously cached WDA instance at 'http://localhost:8100/' with 'com.facebook.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
[BaseDriver] Event 'wdaStartAttempted' logged at 1541504175088 (19:36:15 GMT+0800 (CST))
[XCUITest] Using provided WebdriverAgent at 'http://localhost:8100/'
[BaseDriver] Event 'wdaSessionAttempted' logged at 1541504175089 (19:36:15 GMT+0800 (CST))
[XCUITest] Sending createSession command to WDA
[JSONWP Proxy] Matched '/status' to command name 'getStatus'
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n \"state\" : \"success\",\n \"os\" : {\n \"name\" : \"iOS\",\n \"version\" : \"11.4.1\",\n \"sdkVersion\" : \"12.0\"\n },\n \"ios\" : {\n \"simulatorVersion\" : \"11.4.1\",\n \"ip\" : \"192.168.8.208\"\n },\n \"build\" : {\n \"time\" : \"Nov 6 2018 10:49:44\",\n \"productBundleIdentifier\" : \"com.facebook.WebDriverAgentRunner\"\n }\n },\n \"sessionId\" : \"D7FADEC2-1743-496C-99E0-2BE858CB68C2\",\n \"status\" : 0\n}"
[JSONWP Proxy] Matched '/session' to command name 'createSession'
[JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"cn.xiaochuankeji.tieba-ih","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
[JSONWP Proxy] Got response with status 200: {"value":{"sessionId":"88A298CD-7DD0-4619-8A90-46A8E8A8D98D","capabilities":{"device":"iphone","browserName":"最右 - 内测","sdkVersion":"11.4.1","CFBundleIdentifier":"cn.xiaochuankeji.tieba-ih"}},"sessionId":"88A298CD-7DD0-4619-8A90-46A8E8A8D98D","status":0}
[BaseDriver] Event 'wdaSessionStarted' logged at 1541504179987 (19:36:19 GMT+0800 (CST))
[BaseDriver] Event 'wdaStarted' logged at 1541504179987 (19:36:19 GMT+0800 (CST))
[XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
[BaseDriver] Event 'orientationSet' logged at 1541504179988 (19:36:19 GMT+0800 (CST))
[Appium] New XCUITestDriver session created successfully, session b1652ae3-b4ed-440f-bea8-160a6af16a7f added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1541504179989 (19:36:19 GMT+0800 (CST))
[W3C] Cached the protocol value 'W3C' for the new session b1652ae3-b4ed-440f-bea8-160a6af16a7f
[W3C] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"iOS","app":"cn.xiaochuankeji.tieba-ih","platformVersion":"11.4.1","deviceName":"testphone","automationName":"XCUITest","udid":"48b92f5466bb72c7b00462eea82fb2b7de976a1d","newCommandTimeout":300,"xcodeOrgId":"xxxxxxxxxxxxxxxxxxxxxxx","xcodeSigningId":"iPhone Developer"}}
[HTTP] <-- POST /wd/hub/session 200 7553 ms - 565
[HTTP]
[HTTP] --> POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element
[HTTP] {"using":"accessibility id","value":"(profileButton)","sessionId":"b1652ae3-b4ed-440f-bea8-160a6af16a7f"}
[W3C] Calling AppiumDriver.findElement() with args: ["accessibility id","(profileButton)","b1652ae3-b4ed-440f-bea8-160a6af16a7f"]
[XCUITest] Executing command 'findElement'
[BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[BaseDriver] Waiting up to 0 ms for condition
[JSONWP Proxy] Matched '/element' to command name 'findElement'
[JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/88A298CD-7DD0-4619-8A90-46A8E8A8D98D/element] with body: {"using":"accessibility id","value":"(profileButton)"}
[JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"22000000-0000-0000-3A02-000000000000"},"sessionId":"88A298CD-7DD0-4619-8A90-46A8E8A8D98D","status":0}
[W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"22000000-0000-0000-3A02-000000000000"}
[HTTP] <-- POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element 200 3903 ms - 88
[HTTP]
[HTTP] --> POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/22000000-0000-0000-3A02-000000000000/click
[HTTP] {"id":"22000000-0000-0000-3A02-000000000000","sessionId":"b1652ae3-b4ed-440f-bea8-160a6af16a7f"}
[W3C] Driver proxy active, passing request on via HTTP proxy
[XCUITest] Executing command 'proxyReqRes'
[JSONWP Proxy] Matched '/wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/22000000-0000-0000-3A02-000000000000/click' to command name 'click'
[JSONWP Proxy] Proxying [POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/22000000-0000-0000-3A02-000000000000/click] to [POST http://localhost:8100/session/88A298CD-7DD0-4619-8A90-46A8E8A8D98D/element/22000000-0000-0000-3A02-000000000000/click] with body: {"id":"22000000-0000-0000-3A02-000000000000","sessionId":"b1652ae3-b4ed-440f-bea8-160a6af16a7f"}
[JSONWP Proxy] Got response with status 200: {"status":0,"id":"22000000-0000-0000-3A02-000000000000","value":"","sessionId":"88A298CD-7DD0-4619-8A90-46A8E8A8D98D"}
[JSONWP Proxy] Replacing sessionId 88A298CD-7DD0-4619-8A90-46A8E8A8D98D with b1652ae3-b4ed-440f-bea8-160a6af16a7f
[HTTP] <-- POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/22000000-0000-0000-3A02-000000000000/click 200 8350 ms - 118
[HTTP]
[HTTP] --> POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element
[HTTP] {"using":"-ios predicate string","value":"value == '我的帖子'","sessionId":"b1652ae3-b4ed-440f-bea8-160a6af16a7f"}
[W3C] Calling AppiumDriver.findElement() with args: ["-ios predicate string","value == '我的帖子'","b1652ae3-b4ed-440f-bea8-160a6af16a7f"]
[XCUITest] Executing command 'findElement'
[BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[BaseDriver] Waiting up to 0 ms for condition
[JSONWP Proxy] Matched '/element' to command name 'findElement'
[JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/88A298CD-7DD0-4619-8A90-46A8E8A8D98D/element] with body: {"using":"predicate string","value":"value == '我的帖子'"}
[JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"00000000-0000-0000-0000-000000000000"},"sessionId":"88A298CD-7DD0-4619-8A90-46A8E8A8D98D","status":0}
[W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"00000000-0000-0000-0000-000000000000"}
[HTTP] <-- POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element 200 1248 ms - 88
[HTTP]
[HTTP] --> POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/00000000-0000-0000-0000-000000000000/click
[HTTP] {"id":"00000000-0000-0000-0000-000000000000","sessionId":"b1652ae3-b4ed-440f-bea8-160a6af16a7f"}
[W3C] Driver proxy active, passing request on via HTTP proxy
[XCUITest] Executing command 'proxyReqRes'
[JSONWP Proxy] Matched '/wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/00000000-0000-0000-0000-000000000000/click' to command name 'click'
[JSONWP Proxy] Proxying [POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/00000000-0000-0000-0000-000000000000/click] to [POST http://localhost:8100/session/88A298CD-7DD0-4619-8A90-46A8E8A8D98D/element/00000000-0000-0000-0000-000000000000/click] with body: {"id":"00000000-0000-0000-0000-000000000000","sessionId":"b1652ae3-b4ed-440f-bea8-160a6af16a7f"}
[JSONWP Proxy] Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"The element '\"(titleLabel)\" StaticText' is not visible on the screen and thus is not interactable\" UserInfo={NSLocalizedDescription=The element '\"(titleLabel)\" StaticText' is not visible on the screen and thus is not interactable}","sessionId":"88A298CD-7DD0-4619-8A90-46A8E8A8D98D","status":13}
[W3C] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: The request to /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/00000000-0000-0000-0000-000000000000/click has failed
[W3C] at JWProxy.proxy$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:182:13)
[W3C] at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[W3C] at GeneratorFunctionPrototype.invoke as _invoke
[W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) as next
[W3C] at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[W3C] at run (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:75:1)
[W3C] at /Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:92:1
[W3C] at flush (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/_microtask.js:18:1)
[W3C] at process._tickCallback (internal/process/next_tick.js:61:11)
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[HTTP] <-- POST /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f/element/00000000-0000-0000-0000-000000000000/click 500 12061 ms - 2451
[HTTP]
[HTTP] --> DELETE /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f
[HTTP] {}
[W3C] Calling AppiumDriver.deleteSession() with args: ["b1652ae3-b4ed-440f-bea8-160a6af16a7f"]
[BaseDriver] Event 'quitSessionRequested' logged at 1541504213637 (19:36:53 GMT+0800 (CST))
[Appium] Removing session b1652ae3-b4ed-440f-bea8-160a6af16a7f from our master session list
[JSONWP Proxy] Matched '/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f' to command name 'deleteSession'
[JSONWP Proxy] Proxying [DELETE /session/b1652ae3-b4ed-440f-bea8-160a6af16a7f] to [DELETE http://localhost:8100/session/88A298CD-7DD0-4619-8A90-46A8E8A8D98D] with no body
[JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n\n },\n \"sessionId\" : \"4F1EC895-8779-4B7E-BC0B-55DF9337AC9E\",\n \"status\" : 0\n}"
[XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[iOSLog] Stopping iOS log capture
[BaseDriver] Event 'quitSessionFinished' logged at 1541504214688 (19:36:54 GMT+0800 (CST))
[W3C] Received response: null
[W3C] But deleting session, so not returning
[W3C] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/b1652ae3-b4ed-440f-bea8-160a6af16a7f 200 1053 ms - 14
[HTTP]
[XCUITest] Connection to WDA timed out
[iProxy] recv failed: Operation not permitted


↙↙↙阅读原文可查看相关链接,并与作者交流