Appium inspector is always loading - mobile

I'm trying to inspect my iOS application with Appium desktop. So, I open the server and I selected "start inspector session" then I select my capability and start the session. But the inspector is always loading[1]: https://i.stack.imgur.com/AmecM.png
This is the server log:
[RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] }, [RemoteDebugger] "3": { [RemoteDebugger] "WIRPageIdentifierKey": 3, [RemoteDebugger] "WIRTitleKey": "JSContext", [RemoteDebugger] "WIRTypeKey": "WIRTypeJavaScript" [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [RemoteDebugger] Sending connection key request [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 0): 'setConnectionKey' [RemoteDebugger] Sending to Web Inspector took 4ms [RemoteDebugger] Sending connection key request [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 2): 'setConnectionKey' [RemoteDebugger] Sending to Web Inspector took 5ms [RemoteDebugger] Selecting application [RemoteDebugger] No applications currently connected. [XCUITest] No web frames found. [MJSONWP (43b20adf)] Responding to client with driver.getContexts() result: ["NATIVE_APP"] [HTTP] <-- GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/contexts 200 154 ms - 86 [HTTP] [HTTP] --> GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/context [HTTP] {} [MJSONWP (43b20adf)] Calling AppiumDriver.getCurrentContext() with args: ["43b20adf-95cc-4540-82c9-14a89a80b60b"] [XCUITest] Executing command 'getCurrentContext' [MJSONWP (43b20adf)] Responding to client with driver.getCurrentContext() result: "NATIVE_APP" [HTTP] <-- GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/context 200 6 ms - 84 [HTTP] [HTTP] --> GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b [HTTP] {} [MJSONWP (43b20adf)] Calling AppiumDriver.getSession() with args: ["43b20adf-95cc-4540-82c9-14a89a80b60b"] [XCUITest] Executing command 'getSession' [WD Proxy] Matched '/' to command name 'getSession' [WD Proxy] Proxying [GET /] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E] with no body [RemoteDebugger] Received connected automation availability state: "WIRAutomationAvailabilityNotAvailable" [RemoteDebugger] Received connected applications list: PID:803, PID:802, PID:71 [RemoteDebugger] Received connected driver list: {} [WD Proxy] Got response with status 200: {"value":{"sessionId":"586DDD81-0AE5-428A-B530-02468EB7F18E","capabilities":{"device":"iphone","browserName":"Motorna","sdkVersion":"14.1","CFBundleIdentifier":"com.machinesTalk.motorna"}},"sessionId":"586DDD81-0AE5-428A-B530-02468EB7F18E"} [WD Proxy] Proxying [GET /wda/screen] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/wda/screen] with no body [WD Proxy] Got response with status 200: {"value":{"statusBarSize":{"width":414,"height":44},"scale":3},"sessionId":"586DDD81-0AE5-428A-B530-02468EB7F18E"} [WD Proxy] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/window/size] with no body [WD Proxy] Got response with status 200: {"value":{"width":414,"height":896},"sessionId":"586DDD81-0AE5-428A-B530-02468EB7F18E"} [XCUITest] Merging WDA caps over Appium caps for session detail response [MJSONWP (43b20adf)] Responding to client with driver.getSession() result: {"udid":"00008020-00097D001423002E","automationName":"XCUITest","bundleId":"com.machinesTalk.motorna","deviceName":"XmaxiPhone","platformName":"iOS","platformVersion":"14.1","xcodeOrgId":"ST4BY654BM","xcodeSigningId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true,"device":"iphone","browserName":"Motorna","sdkVersion":"14.1","CFBundleIdentifier":"com.machinesTalk.motorna","pixelRatio":3,"statBarHeight":44,"viewportRect":{"left":0,"top":132,"width":1242,"height":2556}} [HTTP] <-- GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b 200 580 ms - 568 [HTTP] [HTTP] --> GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/window/current/size [HTTP] {} [MJSONWP (43b20adf)] Calling AppiumDriver.getWindowSize() with args: ["current","43b20adf-95cc-4540-82c9-14a89a80b60b"] [XCUITest] Executing command 'getWindowSize' [WD Proxy] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/window/size] with no body [WD Proxy] Got response with status 200: {"value":{"width":414,"height":896},"sessionId":"586DDD81-0AE5-428A-B530-02468EB7F18E"} [MJSONWP (43b20adf)] Responding to client with driver.getWindowSize() result: {"width":414,"height":896} [HTTP] <-- GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/window/current/size 200 60 ms - 98 [HTTP] [HTTP] --> POST /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/execute [HTTP] {"script":"mobile:getContexts","args":[]} [MJSONWP (43b20adf)] Calling AppiumDriver.execute() with args: ["mobile:getContexts",[],"43b20adf-95cc-4540-82c9-14a89a80b60b"] [XCUITest] Executing command 'execute' [XCUITest] Getting list of available contexts [iOS] Retrieving contexts and views [XCUITest] Selecting by url: false [RemoteDebugger] Sending connection key request [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 4): 'setConnectionKey' [RemoteDebugger] Sending to Web Inspector took 4ms [RemoteDebugger] Selecting application [RemoteDebugger] Current applications available: [RemoteDebugger] Application: "PID:803" [RemoteDebugger] id: "PID:803" [RemoteDebugger] isProxy: true [RemoteDebugger] name: "com.apple.WebKit.WebContent" [RemoteDebugger] bundleId: "process-com.apple.WebKit.WebContent" [RemoteDebugger] hostId: "PID:802" [RemoteDebugger] isActive: true [RemoteDebugger] isAutomationEnabled: "Unknown" [RemoteDebugger] Application: "PID:802" [RemoteDebugger] id: "PID:802" [RemoteDebugger] isProxy: false [RemoteDebugger] name: "Motorna" [RemoteDebugger] bundleId: "com.machinesTalk.motorna" [RemoteDebugger] hostId: undefined [RemoteDebugger] isActive: true [RemoteDebugger] isAutomationEnabled: "Unknown" [RemoteDebugger] Checking for bundle identifiers: com.apple.WebKit.WebContent, process-com.apple.WebKit.WebContent, process-SafariViewService, com.apple.SafariViewService, *, com.machinesTalk.motorna [RemoteDebugger] Found app id key 'PID:803' for bundle 'com.apple.WebKit.WebContent' [RemoteDebugger] Found app id key 'PID:803' for bundle 'process-com.apple.WebKit.WebContent' [RemoteDebugger] Found app id key 'PID:803' for bundle 'process-SafariViewService' [RemoteDebugger] Found app id key 'PID:803' for bundle 'com.apple.SafariViewService' [RemoteDebugger] Found app id key 'PID:803' for bundle '*' [RemoteDebugger] Found app id key 'PID:802' for bundle 'com.machinesTalk.motorna' [RemoteDebugger] Found separate bundleId 'process-com.apple.WebKit.WebContent' acting as proxy for 'com.machinesTalk.motorna', with app id 'PID:803' [RemoteDebugger] Trying out the possible app ids: PID:803, PID:802 (try #1 of 20) [RemoteDebugger] Attempting app 'PID:803' [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:803' (id: 6): 'connectToApp' [RemoteDebugger] Received response from send (id: 6): '["PID:803",{}]' [RemoteDebugger] Sending to Web Inspector took 20ms [RemoteDebugger] Empty page dictionary received [RemoteDebugger] Error checking application: 'Empty page dictionary received'. Retrying connection [RemoteDebugger] Attempting app 'PID:802' [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to app 'PID:802' (id: 8): 'connectToApp' [RemoteDebugger] Received response from send (id: 8): '["PID:802",{"1":{"WIRTitleKey":"","WIRTypeKey":"WIRTypeWebPage","WIRURLKey":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framewo...' [RemoteDebugger] Page changed: { [RemoteDebugger] "1": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [RemoteDebugger] Sending to Web Inspector took 20ms [RemoteDebugger] Received page change notice for app 'PID:802' but the listing has not changed. Ignoring. [RemoteDebugger] Page changed: { [RemoteDebugger] "1": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [RemoteDebugger] Received altered app id, updating from 'null' to 'PID:802' [RemoteDebugger] Current applications available: [RemoteDebugger] Application: "PID:803" [RemoteDebugger] id: "PID:803" [RemoteDebugger] isProxy: true [RemoteDebugger] name: "com.apple.WebKit.WebContent" [RemoteDebugger] bundleId: "process-com.apple.WebKit.WebContent" [RemoteDebugger] hostId: "PID:802" [RemoteDebugger] isActive: true [RemoteDebugger] isAutomationEnabled: "Unknown" [RemoteDebugger] Application: "PID:802" [RemoteDebugger] id: "PID:802" [RemoteDebugger] isProxy: false [RemoteDebugger] name: "Motorna" [RemoteDebugger] bundleId: "com.machinesTalk.motorna" [RemoteDebugger] hostId: undefined [RemoteDebugger] isActive: true [RemoteDebugger] isAutomationEnabled: "Unknown" [RemoteDebugger] pageArray: [RemoteDebugger] - id: 1 [RemoteDebugger] title: "" [RemoteDebugger] url: "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/" [RemoteDebugger] isKey: false [RemoteDebugger] Finally selecting app PID:802: [{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}] [RemoteDebugger] Selected app after 50ms [XCUITest] Found webview context after 55ms [MJSONWP (43b20adf)] Responding to client with driver.execute() result: [{"id":"NATIVE_APP"},{"id":"WEBVIEW_802.1","title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","bundleId":"com.machinesTalk.motorna"}] [HTTP] <-- POST /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/execute 200 56 ms - 297 [HTTP] [HTTP] --> GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/source [HTTP] {} [MJSONWP (43b20adf)] Calling AppiumDriver.getPageSource() with args: ["43b20adf-95cc-4540-82c9-14a89a80b60b"] [XCUITest] Executing command 'getPageSource' [WD Proxy] Matched '/source' to command name 'getPageSource' [WD Proxy] Proxying [GET /source] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/source] with no body [WD Proxy] Got response with status 200: {"value":"\n\n \n \n \n \n \n [MJSONWP (43b20adf)] Responding to client with driver.getPageSource() result: "\n \n \n \n \n \n [HTTP] <-- GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/source 200 151 ms - 3122 [HTTP] [HTTP] --> GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/screenshot [HTTP] {} [MJSONWP (43b20adf)] Calling AppiumDriver.getScreenshot() with args: ["43b20adf-95cc-4540-82c9-14a89a80b60b"] [XCUITest] Executing command 'getScreenshot' [XCUITest] Taking screenshot with WDA [WD Proxy] Matched '/screenshot' to command name 'getScreenshot' [WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/screenshot] with no body [WD Proxy] Got response with status 500: {"value":{"error":"unknown error","message":"-[XCUIScreen screenshotDataForQuality:rect:error:]: unrecognized selector sent to instance 0x282b25e40","traceback":"(\n\t0 CoreFoundation 0x00000001aa7da5c0 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1185216\n\t1 libobjc.A.dylib 0x00000001be8c842c objc_exception_throw + 60\n\t2 CoreFoundation 0x00000001aa6e4a2c 52963DBA-FA89-36C2-8262-28B9776F8C12 + 178732\n\t3 CoreFoundation 0x00000001aa7dd130 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1196336\n\t4 CoreFoundation 0x00000001aa7df420 _CF_forwarding_prep_0 + 96\n\t5 WebDriverAgentLib 0x0000000102adf93c -[XCUIDevice(FBHelpers) fb_rawScreenshotWithQuality:error:] + 156\n\t6 WebDriverAgentLib 0x0000000102adf808 -[XCUIDevice(FBHelpers) fb_screenshotWithError:] + 88\n\t7 WebDriverAgentLib 0x0000000102a7f350 +[FBScreenshotCommands handleGetScreenshot:] + 1... [W3C] Matched W3C error code 'unknown error' to UnknownError [XCUITest] Error getting screenshot: An unknown server-side error occurred while processing the command. Original error: -[XCUIScreen screenshotDataForQuality:rect:error:]: unrecognized selector sent to instance 0x282b25e40 [XCUITest] Taking screenshot with WDA [WD Proxy] Matched '/screenshot' to command name 'getScreenshot' [WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/screenshot] with no body [WD Proxy] Got response with status 500: {"value":{"error":"unknown error","message":"-[XCUIScreen screenshotDataForQuality:rect:error:]: unrecognized selector sent to instance 0x282b0c680","traceback":"(\n\t0 CoreFoundation 0x00000001aa7da5c0 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1185216\n\t1 libobjc.A.dylib 0x00000001be8c842c objc_exception_throw + 60\n\t2 CoreFoundation 0x00000001aa6e4a2c 52963DBA-FA89-36C2-8262-28B9776F8C12 + 178732\n\t3 CoreFoundation 0x00000001aa7dd130 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1196336\n\t4 CoreFoundation 0x00000001aa7df420 _CF_forwarding_prep_0 + 96\n\t5 WebDriverAgentLib 0x0000000102adf93c -[XCUIDevice(FBHelpers) fb_rawScreenshotWithQuality:error:] + 156\n\t6 WebDriverAgentLib 0x0000000102adf808 -[XCUIDevice(FBHelpers) fb_screenshotWithError:] + 88\n\t7 WebDriverAgentLib 0x0000000102a7f350 +[FBScreenshotCommands handleGetScreenshot:] + 1... [W3C] Matched W3C error code 'unknown error' to UnknownError [XCUITest] Taking screenshot with WDA [WD Proxy] Matched '/screenshot' to command name 'getScreenshot' [WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E/screenshot] with no body [WD Proxy] Got response with status 500: {"value":{"error":"unknown error","message":"-[XCUIScreen screenshotDataForQuality:rect:error:]: unrecognized selector sent to instance 0x282b00480","traceback":"(\n\t0 CoreFoundation 0x00000001aa7da5c0 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1185216\n\t1 libobjc.A.dylib 0x00000001be8c842c objc_exception_throw + 60\n\t2 CoreFoundation 0x00000001aa6e4a2c 52963DBA-FA89-36C2-8262-28B9776F8C12 + 178732\n\t3 CoreFoundation 0x00000001aa7dd130 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1196336\n\t4 CoreFoundation 0x00000001aa7df420 _CF_forwarding_prep_0 + 96\n\t5 WebDriverAgentLib 0x0000000102adf93c -[XCUIDevice(FBHelpers) fb_rawScreenshotWithQuality:error:] + 156\n\t6 WebDriverAgentLib 0x0000000102adf808 -[XCUIDevice(FBHelpers) fb_screenshotWithError:] + 88\n\t7 WebDriverAgentLib 0x0000000102a7f350 +[FBScreenshotCommands handleGetScreenshot:] + 1... [W3C] Matched W3C error code 'unknown error' to UnknownError [MJSONWP (43b20adf)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: -[XCUIScreen screenshotDataForQuality:rect:error:]: unrecognized selector sent to instance 0x282b00480 [MJSONWP (43b20adf)] at errorFromW3CJsonCode (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:780:25) [MJSONWP (43b20adf)] at ProxyRequestError.getActualError (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:663:14) [MJSONWP (43b20adf)] at JWProxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:273:19) [MJSONWP (43b20adf)] at runMicrotasks () [MJSONWP (43b20adf)] at processTicksAndRejections (internal/process/task_queues.js:85:5) [HTTP] <-- GET /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b/screenshot 500 1069 ms - 273 [HTTP] [WebDriverAgent] Parsed BUILD_DIR configuration value: '/Users/macbookair/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Build/Products' [WebDriverAgent] Got derived data root: '/Users/macbookair/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp' [RemoteDebugger] We were notified we might have connected to the wrong app. Using id PID:805 instead of PID:802 [RemoteDebugger] We were notified we might have connected to the wrong app. Using id PID:805 instead of PID:802 [RemoteDebugger] Notified that new application 'PID:805' has connected [RemoteDebugger] Notified that new application 'PID:805' has connected [RemoteDebugger] Page changed: { [RemoteDebugger] "1": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] }, [RemoteDebugger] "4": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 4 [RemoteDebugger] }, [RemoteDebugger] "5": { [RemoteDebugger] "WIRPageIdentifierKey": 5, [RemoteDebugger] "WIRTitleKey": "JSContext", [RemoteDebugger] "WIRTypeKey": "WIRTypeJavaScript" [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false},{"id":4,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [RemoteDebugger] Page changed: { [RemoteDebugger] "1": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] }, [RemoteDebugger] "4": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 4 [RemoteDebugger] }, [RemoteDebugger] "5": { [RemoteDebugger] "WIRPageIdentifierKey": 5, [RemoteDebugger] "WIRTitleKey": "JSContext", [RemoteDebugger] "WIRTypeKey": "WIRTypeJavaScript" [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false},{"id":4,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [RemoteDebugger] Notified that new application 'PID:807' has connected [RemoteDebugger] Notified that new application 'PID:807' has connected [RemoteDebugger] Page changed: { [RemoteDebugger] "1": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] }, [RemoteDebugger] "4": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 4 [RemoteDebugger] }, [RemoteDebugger] "6": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 6 [RemoteDebugger] }, [RemoteDebugger] "7": { [RemoteDebugger] "WIRPageIdentifierKey": 7, [RemoteDebugger] "WIRTitleKey": "JSContext", [RemoteDebugger] "WIRTypeKey": "WIRTypeJavaScript" [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false},{"id":4,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false},{"id":6,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [RemoteDebugger] Page changed: { [RemoteDebugger] "1": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 1 [RemoteDebugger] }, [RemoteDebugger] "4": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 4 [RemoteDebugger] }, [RemoteDebugger] "6": { [RemoteDebugger] "WIRTitleKey": "", [RemoteDebugger] "WIRTypeKey": "WIRTypeWebPage", [RemoteDebugger] "WIRURLKey": "file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/", [RemoteDebugger] "WIRPageIdentifierKey": 6 [RemoteDebugger] }, [RemoteDebugger] "7": { [RemoteDebugger] "WIRPageIdentifierKey": 7, [RemoteDebugger] "WIRTitleKey": "JSContext", [RemoteDebugger] "WIRTypeKey": "WIRTypeJavaScript" [RemoteDebugger] } [RemoteDebugger] } [XCUITest] Remote debugger notified us of a new page listing: {"appIdKey":"802","pageArray":[{"id":1,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false},{"id":4,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false},{"id":6,"title":"","url":"file:///var/containers/Bundle/Application/3E625C3A-845C-46CB-B481-A7F55901EB76/CarsTalk-R1.app/Frameworks/SwiftR.framework/","isKey":false}]} [XCUITest] No key id found. Choosing first id from page array [XCUITest] We do not appear to have window set yet, ignoring [HTTP] --> DELETE /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b [HTTP] {} [MJSONWP (43b20adf)] Calling AppiumDriver.deleteSession() with args: ["43b20adf-95cc-4540-82c9-14a89a80b60b"] [BaseDriver] Event 'quitSessionRequested' logged at 1620779743495 (02:35:43 GMT+0200 (heure d’été d’Europe centrale)) [Appium] Removing session 43b20adf-95cc-4540-82c9-14a89a80b60b from our master session list [WD Proxy] Matched '/session/43b20adf-95cc-4540-82c9-14a89a80b60b' to command name 'deleteSession' [WD Proxy] Proxying [DELETE /session/43b20adf-95cc-4540-82c9-14a89a80b60b] to [DELETE http://127.0.0.1:8100/session/586DDD81-0AE5-428A-B530-02468EB7F18E] with no body [RemoteDebugger] Application 'PID:802' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'PID:802' [RemoteDebugger] No longer have app id. Attempting to find new one. [RemoteDebugger] Application 'PID:807' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'undefined' [RemoteDebugger] Application 'PID:803' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'undefined' [RemoteDebugger] Application 'PID:805' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'undefined' [RemoteDebugger] Application 'PID:802' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'PID:802' [RemoteDebugger] No longer have app id. Attempting to find new one. [RemoteDebugger] Application 'PID:807' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'undefined' [RemoteDebugger] Application 'PID:803' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'undefined' [RemoteDebugger] Application 'PID:805' disconnected. Removing from app dictionary. [RemoteDebugger] Current app is 'undefined' [WD Proxy] Got response with status 200: {"value":null,"sessionId":null} [DevCon Factory] Releasing connections for 00008020-00097D001423002E device on any port number [DevCon Factory] Found cached connections to release: ["00008020-00097D001423002E:8100"] [DevCon Factory] Releasing the listener for '00008020-00097D001423002E:8100' [iProxy#00008020:8100] Closing the connection [DevCon Factory] Cached connections count: 0 [XCUITest] Not clearing log files. Use clearSystemFilescapability to turn on. [XCUITest] Found a remote debugger session. Removing... [RemoteDebugger] Disconnecting from remote debugger [RemoteDebugger] Cleaning up listeners [BaseDriver] Event 'quitSessionFinished' logged at 1620779744527 (02:35:44 GMT+0200 (heure d’été d’Europe centrale)) [MJSONWP (43b20adf)] Received response: null [MJSONWP (43b20adf)] But deleting session, so not returning [MJSONWP (43b20adf)] Responding to client with driver.deleteSession() result: null [HTTP] <-- DELETE /wd/hub/session/43b20adf-95cc-4540-82c9-14a89a80b60b 200 1033 ms - 76 [HTTP]
Any idea please?

Mach! Welcome to StackOverflow.
I have had a similar problem to yours when I had copied the capabilities from the WebDriverIO config to the inspector and the app started on my device but never loaded in the inspector.
The Appium logs indicated that a "method" was not implemented. Appium wraps the Flutter Driver using one of the platform specific automation Drivers and it needs to know which wrapper to use in the inspector, otherwise it cannot interact with the app. It needs to do this to call getPageSource() which is what is displayed in that section that's still loading.
I was testing on an Android device, so I changed my "automationName" field to "UiAutomator2" and it worked for me. For iOS you could try "XCUITest" or "Instruments".
See the device capabilities docs page for references to this and the available AutomationNames.
It's also worth noting that Appium requires the following environment variables to bet set or it will be unable to run normally:
JAVA_HOME
ANDROID_HOME
Here is a decent reference for configuring and using Appium: Clarabez's Appium Course (in English)
Otherwise, check the Appium server logs themselves for errors or exceptions. You can check them in the window like in my screenshot or log them to a file for reviewing.

Related

Getting a timeout when i try to add data to mongodb (via mongoose)

I am new to MERN development and I have been trying to add the username, email and password of a user to database but i get this error(when i try to add user after connecting to the database from thunderclient in json format in vscode):
[nodemon] 2.0.19
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node ./index.js`
Example app listening on port 3000
connected to mongodb successfully
{ name: 'kashish', email: 'mail#mail.com', password: '1234' }
/home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:151
const err = new MongooseError(message);
^
MongooseError: Operation `users.insertOne()` buffering timed out after 10000ms
at Timeout.<anonymous> (/home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:151:23)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7)
Node.js v18.7.0
[nodemon] app crashed - waiting for file changes before starting...
The code connects to the database successfully, but when i try to add the user (using thunder client before calling the api) it just shows me the given error here is the code which connects to the database and the one which saves data in database respectively:
const mongoose=require("mongoose")
const mongoUri="mongodb://localhost:27017"
const connectMongo=() => {
mongoose.connect(mongoUri,() => {
console.log("connected to mongodb successfully");
}).catch(error => handleError(error))
}
module.exports=connectMongo;
the code that adds user:
const express=require('express');
const User=require('../models/User');
const router=express.Router();
router.get('/',(req,res) => {
console.log(req.body);
const user=User(req.body);
user.save()
res.send(req.body);
})
module.exports=router;
I tried going through similar issues from the forum but i don't understand any of them, what am i missing?
another edit:
When i tried using async function and added await before user.save(), the response didn't occur, not sure if that is obvious but the user data shows up in console but there happens to be an error during saving data, is it possible that the timeout happens before the data can be saved? i am hosting mongodb on localhost so this is not an internet issue
here is the updated code for auth.js:
const express=require('express');
const User=require('../models/User');
const router=express.Router();
router.get('/',async (req,res) => {
console.log(req.body);
const user=User(req.body);
await user.save()
res.send(req.body);
})
module.exports=router;
updated code of db.js (connecting to database) with error handling:
const mongoose=require("mongoose")
const mongoUri="mongodb://localhost:27017"
const connectMongo=() => {
mongoose.connect(mongoUri).then(
() => console.log('connected')
).catch(e => console.log('error',e))
}
module.exports=connectMongo;
after the above update in code this shows up in a few mins:
Example app listening on port 3000
error MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at Connection.openUri (/home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/connection.js:824:32)
at /home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/index.js:380:10
at /home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
at new Promise (<anonymous>)
at promiseOrCallback (/home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
at Mongoose._promiseOrCallback (/home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/index.js:1225:10)
at Mongoose.connect (/home/alien/codes/webDev/react/inotebook/backend/node_modules/mongoose/lib/index.js:379:20)
at connectMongo (/home/alien/codes/webDev/react/inotebook/backend/db.js:5:14)
at Object.<anonymous> (/home/alien/codes/webDev/react/inotebook/backend/index.js:3:1)
at Module._compile (node:internal/modules/cjs/loader:1120:14) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
},
code: undefined
}
and before you ask, i already ran sudo systemctl start mongodb before starting the app. here is the output of sudo systemctl status mongodb:
● mongodb.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongodb.service; disabled; preset: disabled)
Active: active (running) since Mon 2022-08-22 14:59:01 IST; 24s ago
Docs: https://docs.mongodb.org/manual
Main PID: 5840 (mongod)
Memory: 163.0M
CPU: 857ms
CGroup: /system.slice/mongodb.service
└─5840 /usr/bin/mongod --config /etc/mongodb.conf
error MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
This issue can occur when the MongoDB client is trying to connect to the MongoDB server over IPv6, but the server isn't actually listening on IPv6 (for whatever reason; I think that older versions of the server had to be told to listen on IPv6 but more recent versions should do so automatically, unless it's explicitly turned off).
To force the client to connect over IPv4, use the IPv4 localhost address:
const mongoUri="mongodb://127.0.0.1:27017"

Google appengine cloud tasks alpha handler http 404 error

When I send a task to a task queue it keeps failing and shows a http 404 (not found) error in the logs.
The project has been whitelisted for cloud tasks alpha on flexible.
I can send HTTP post requests to /endpointpath & /tasks/worker locally without any errors.
The endpoint works fine and adds the task to the task queue.
13:37:41.300 POST 200 0 B 422 ms curl/7.54.0 /endpointspath?key=keyremoved 0.0.0.0 - "POST endpointspath?key=keyremoved" 200 undefined "-" "curl/7.54.0"
The app is running as the default service.
app.go main func:
func main() {
r := mux.NewRouter()
r.HandleFunc("/", handler)
r.HandleFunc("/_ah/health", healthCheckHandler)
// Task handlers
r.Path("/tasks/worker").Methods("POST", "GET", "PUT").HandlerFunc(workerTaskHandler)
// Endpoints
r.Path("/endpointpath").Methods("POST").HandlerFunc(searchHandler)
http.Handle("/", r)
port := 8080
if portStr := os.Getenv("PORT"); portStr != "" {
port, _ = strconv.Atoi(portStr)
}
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
}
abbreviated app.yaml:
runtime: go
env: flex
handlers:
- url: /tasks/.*
script: _go_app
- url: /.*
script: _go_app
Logs HTTP 404 response when queue dispatches request to worker:
10.0.0.1 - "POST /tasks/worker" 404 200 "-" "AppEngine-Google; (+http://code.google.com/appengine)"
Expand all | Collapse all {
httpRequest: {
latency: "0s"
referer: "-"
remoteIp: "10.0.0.1"
requestMethod: "POST"
requestUrl: "/tasks/worker"
responseSize: "200"
status: 404
userAgent: "AppEngine-Google; (+http://code.google.com/appengine)"
}
insertId: "......."
jsonPayload: {
appLatencySeconds: "-"
latencySeconds: "0.000"
time: null
trace: "......."
}
labels: {
appengine.googleapis.com/instance_name: "......"
appengine.googleapis.com/trace_id: "......."
compute.googleapis.com/resource_id: "......."
compute.googleapis.com/resource_name: "......"
compute.googleapis.com/zone: "us-central1-b"
}
logName: "projects/projectname/logs/appengine.googleapis.com%2Fnginx.request"
receiveTimestamp: "2017-12-09T10:56:14.794726383Z"
resource: {
labels: {
module_id: "default"
project_id: "projectname"
version_id: "....."
}
type: "gae_app"
}
timestamp: "2017-12-09T10:56:10.301Z"
}
The closest I can get GAE to find the tasks/worker url is by setting login:admin in app.yaml (even tho flex doesn't use this for authentication). This returns a 403 unauthorised error.
handlers:
- url: /tasks/.*
script: _go_app
login: admin
Here is the 403 response in the logs
{
httpRequest: {
latency: "0s"
referer: "-"
remoteIp: "10.0.0.1"
requestMethod: "POST"
requestUrl: "/tasks/worker"
responseSize: "162"
status: 403
userAgent: "AppEngine-Google; (+http://code.google.com/appengine)"
}
insertId: "....."
jsonPayload: {
appLatencySeconds: "-"
latencySeconds: "0.000"
time: null
trace: "....."
}
labels: {
appengine.googleapis.com/instance_name: "...."
appengine.googleapis.com/trace_id: "...."
compute.googleapis.com/resource_id: "...."
compute.googleapis.com/resource_name: "....."
compute.googleapis.com/zone: "us-central1-b"
}
logName: "projects/projectname/logs/appengine.googleapis.com%2Fnginx.request"
receiveTimestamp: "2017-12-09T13:35:59.986118082Z"
resource: {
labels: {
module_id: "default"
project_id: "projectname"
version_id: "....."
}
type: "gae_app"
}
timestamp: "2017-12-09T13:35:54.764Z"
}
Not sure if it's related but projectname.appspot.com/_ah/health returns this error:
{
"code": 5,
"message": "Method does not exist.",
"details": [
{
"#type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": [],
"detail": "service_control"
}
]
}
It turns out endpoints can't run on the same service as task handlers. Task handler url requests are blocked by the ESP proxy if they run on the same service in the flexible environment, and the service has the endpoints service enabled.
Run task handlers on a separate service and do not set "endpoints_api_service:" in the task handler service app.yaml file.
Doing so will prevent the queue from being able to dispatch to workers in the flexible environment.
This isn't mentioned in the app engine documentation which is kinda bizarre.
The "/_ah/health" issue was caused by this path not being set in the open api file. If this path isn't set the url isn't recognised by the proxy.

How to catch AngularJS Error with Protractor

I'm experiencing some problem while E2E testing an AngularJS app with Protractor. To sum things up: I have the following specification and the first step always fails with a btstrpd error. (The page is auto-bootstrapped and we use AngularJS v1.3.0 and Protractor v2.1.0.)
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://myapp.abc.de/ext/#/login');
expect(browser.getTitle()).toEqual('My App');
});
it('should do other stuff', function() {
// ...
});
});
Error:
1) Protractor Demo App should have a title
Message:
UnknownError: unknown error: [ng:btstrpd] http://errors.angularjs.org/1.3.15/ng/btstrpd?p0=document
(Session info: chrome=43.0.2357.132)
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds
(Full description here)
Since I don't seem to find a solution to prevent this error and the remaining test steps run without any problems, my approach would be to simply ignore the error. However I don't want the test case to fail due to it. This brings me to my question: How can I catch this error so that the test won't fail? A plain try-catch around the two statements in the step does not the trick and since I don't have any promises here I also cannot do the typical promise error handling as one would manually handle e.g. a NoSuchElementError.
Edit - Error in webdriver console:
12:06:18.975 INFO - Executing: [new session: Capabilities [{count=1, browserName
=chrome}]])
12:06:18.995 INFO - Creating a new session for Capabilities [{count=1, browserNa
me=chrome}]
Starting ChromeDriver 2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3) on
port 23267
Only local connections are allowed.
12:06:21.248 INFO - Done: [new session: Capabilities [{count=1, browserName=chro
me}]]
12:06:21.271 INFO - Executing: [set script timeoutt: 11000])
12:06:21.281 INFO - Done: [set script timeoutt: 11000]
12:06:21.390 INFO - Executing: [get: data:text/html,<html></html>])
12:06:21.405 INFO - Done: [get: data:text/html,<html></html>]
12:06:21.425 INFO - Executing: [execute script: window.name = "NG_DEFER_BOOTSTRA
P!" + window.name;window.location.replace("http://myapp.abc.de/ext/#/login");, [
]])
12:06:23.440 INFO - Done: [execute script: window.name = "NG_DEFER_BOOTSTRAP!" +
window.name;window.location.replace("http://myapp.abc.de/ext/#/login");, []]
12:06:23.458 INFO - Executing: [execute script: return window.location.href;, []
])
12:06:23.468 INFO - Done: [execute script: return window.location.href;, []]
12:06:23.489 INFO - Executing: [execute async script: try { return (function (at
tempts, asyncCallback) {
var callback = function(args) {
setTimeout(function() {
asyncCallback(args);
}, 0);
};
var check = function(n) {
try {
if (window.angular && window.angular.resumeBootstrap) {
callback([true, null]);
} else if (n < 1) {
if (window.angular) {
callback([false, 'angular never provided resumeBootstrap']);
} else {
callback([false, 'retries looking for angular exceeded']);
}
} else {
window.setTimeout(function() {check(n - 1);}, 1000);
}
} catch (e) {
callback([false, e]);
}
};
check(attempts);
}).apply(this, arguments); }
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [10]])
12:06:25.603 INFO - Done: [execute async script: try { return (function (attempt
s, asyncCallback) {
var callback = function(args) {
setTimeout(function() {
asyncCallback(args);
}, 0);
};
var check = function(n) {
try {
if (window.angular && window.angular.resumeBootstrap) {
callback([true, null]);
} else if (n < 1) {
if (window.angular) {
callback([false, 'angular never provided resumeBootstrap']);
} else {
callback([false, 'retries looking for angular exceeded']);
}
} else {
window.setTimeout(function() {check(n - 1);}, 1000);
}
} catch (e) {
callback([false, e]);
}
};
check(attempts);
}).apply(this, arguments); }
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [10]]
12:06:25.633 INFO - Executing: [execute script: return (function () {
angular.module('protractorBaseModule_', []).
config(['$compileProvider', function($compileProvider) {
if ($compileProvider.debugInfoEnabled) {
$compileProvider.debugInfoEnabled(true);
}
}]);
}).apply(null, arguments);, []])
12:06:25.643 INFO - Done: [execute script: return (function () {
angular.module('protractorBaseModule_', []).
config(['$compileProvider', function($compileProvider) {
if ($compileProvider.debugInfoEnabled) {
$compileProvider.debugInfoEnabled(true);
}
}]);
}).apply(null, arguments);, []]
12:06:25.663 INFO - Executing: [execute script: angular.resumeBootstrap(argument
s[0]);, [[protractorBaseModule_]]])
12:06:26.093 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: [ng:btstrpd] http://error
s.angularjs.org/1.3.15/ng/btstrpd?p0=document
(Session info: chrome=43.0.2357.134)
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7
d3),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any
stacktrace information)
Command duration or timeout: 10 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'xxxxx', ip: 'xxx.xxx.xx.x', os.name: 'Windows 7', os.arch: '
amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEn
abled=false, chrome={userDataDir=C:\Users\abcdefg\AppData\Local\Temp\scoped_dir1
1436_18156}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true,
version=43.0.2357.134, platform=XP, browserConnectionEnabled=false, nativeEvents
=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsE
nabled=true}]
Session ID: 0c39849d960cccef7ec7036b8414c9fb
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.
java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHa
ndler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:599)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDri
ver.java:508)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(Even
tFiringWebDriver.java:101)
at com.sun.proxy.$Proxy1.executeScript(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript
(EventFiringWebDriver.java:213)
at org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteS
cript.java:53)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession
.java:168)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
12:06:26.103 WARN - Exception: unknown error: [ng:btstrpd] http://errors.angular
js.org/1.3.15/ng/btstrpd?p0=document
(Session info: chrome=43.0.2357.134)
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7
d3),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any
stacktrace information)
Command duration or timeout: 10 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'xxxx', ip: 'xxx.xxx.xx.x', os.name: 'Windows 7', os.arch: '
amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEn
abled=false, chrome={userDataDir=C:\Users\abcdefg\AppData\Local\Temp\scoped_dir1
1436_18156}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true,
version=43.0.2357.134, platform=XP, browserConnectionEnabled=false, nativeEvents
=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsE
nabled=true}]
Session ID: 0c39849d960cccef7ec7036b8414c9fb
12:06:26.203 INFO - Executing: [delete session: f947352d-3b40-4b1b-a46a-9d4ffe32
8b76])
12:06:27.417 INFO - Done: [delete session: f947352d-3b40-4b1b-a46a-9d4ffe328b76]
In your code, I would put a WaitforAngular() to make sure the sync append with Angular & Protractor. See bellow for reference:
it('should have a title', function() {
browser.get('http://myapp.abc.de/ext/#/login');
browser.waitForAngular();
expect(browser.getTitle()).toEqual('My App');
});
Then if it does not work, I would use the browser.pause(); command. This will break the execution of protractor where you use the command. From there you can open the Chrome debuging console to see what is appening exactly.
You can also use the REPL debuging mode it is very convenient way to check that you element are present on the page and that you are using the correct selector.
Please refer to the following link for more informations on debugging with protractor: https://angular.github.io/protractor/#/debugging

Issues with Protractor and Element Explorer resolving elements on page

I am able to run my protractor tests against localhost, but when hitting my in-house test server, I can't get protractor to find elements on the page. The same issues occur with Protractor 1.3.1 and 1.4.0 with the latest Chrome and Firefox drivers.
...AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113
var template = new Error(this.message);
^
Process finished with exit code 1
So I've been trying to use the Element explorer to debug the issue, but it is giving me the following:
> list(by.css('#logindropdown'))
There was a webdriver error: UnknownError unknown error: Runtime.evaluate threw exception: TypeError: Cannot read property 'click' of null
(Session info: chrome=38.0.2125.111)
(Driver info: chromedriver=2.12.301325 (962dea43ddd90e7e4224a03fa3c36a421281abb7),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 28 milliseconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'NB2D1469', ip: '158.147.71.49', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Session ID: 85966371ff89f75af8cf7fb5d15f6f23
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\mprent99\AppData\Local\Temp\scoped_dir6488_12276}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=38.0
.2125.111, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
Simple things like list(by.css('body')) also give the same exception above. Using by.id give the same results, list(by.id('logindropdown'))
Commands that have no results (when they should) seem to avoid the exceptions:
> list(by.css('a .caret'))
[ '' ]
> list(by.css('.caret'))
[ '' ]
In the webdriver-manager terminal, I am seeing the following:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.executeAsyncScript(RemoteWebDriver.java:526)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
at com.sun.proxy.$Proxy1.executeAsyncScript(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.executeAsyncScript(EventFiringWebDriver.java:225)
at org.openqa.selenium.remote.server.handler.ExecuteAsyncScript.call(ExecuteAsyncScript.java:55)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
and
17:05:00.256 INFO - Executing: [execute async script: try { return (function (rootSelector, callback) {
var el = document.querySelector(rootSelector);
try {
if (angular.getTestability) {
angular.getTestability(el).whenStable(callback);
} else {
angular.element(el).injector().get('$browser').
notifyWhenNoOutstandingRequests(callback);
}
} catch (e) {
callback(e);
}
}).apply(this, arguments); }
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]])
17:05:00.562 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: Runtime.evaluate threw exception: TypeError: Cannot read property 'click' of null
Versions in use:
protractor --version
Version 1.4.0 or Version 1.3.1
node --version
v0.10.30
webdriver-manager status
selenium standalone is up to date
chromedriver is up to date
IEDriver is not present
These same things work just fine in Chrome DevTools:
('.caret')
[<b class=​"caret">​</b>​]
$('a .caret')
[<b class=​"caret">​</b>​]
$('#logindropdown')
[<li id=​"logindropdown" class=​"dropdown ng-scope">​…​</li>​]
$('body')
[<body class=​"vertical-grow">​…​</body>​]
Here is the onPrepare where the failure appears to be happening:
onPrepare: function() {
var username = element(by.model('login.userName'));
var password = element(by.model('login.password'));
browser.driver.get(env.baseUrl);
browser.driver.findElement(by.css('a .caret')).click();
username.sendKeys('user#company.com');
password.sendKeys('password');
browser.driver.findElement(by.css('.btn-primary')).click();
// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to index.html.
browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return (/dashboards/).test(url);
});
}, 5000);
}
Here is the rest of the conf.js:
/*global browser,element,by */
var env = require('./env.js');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'loginTest.js'
],
suites: {
//smoke: 'spec/smoketests/*.js',
//full: 'spec/*.js'
},
directConnect: false,
multiCapabilities: [
// {browserName: 'firefox'}
{browserName: 'chrome'}
],
maxSessions: -1,
framework: 'jasmine',
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
// If true, display spec names.
isVerbose: false,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 360000
},
// Selector for the element housing the angular app - this defaults to
// body, but is necessary if ng-app is on a descendant of <body>
rootElement: 'html'
};
How do I debug this farther and get to the root of this issue?

using sauce and protractor to test internet explorer and safari

I have the following tests, which run fine when I run them locally and on sauce (at least most of the time) using firefox and chrome.
ptor = protractor.getInstance();
baseUrl = protractor.getInstance().params.sBaseUrl;
aRequiredTextFieldsKeys = [
'sFirstName',
'sLastName',
'sStreet',
'sZip',
'sCity'
];
describe('form', function ()
{
var sFormUrl = baseUrl + '#/form';
beforeEach(function ()
{
ptor.get(sFormUrl);
});
describe('wholeForm', function ()
{
it('fully filled form => required fields have correct class && submit leads to other route', function ()
{
function checkRequiredClass(el)
{
expect(el.getAttribute('class')).toContain('ng-valid-required');
}
// requried text-fields
for (var i = 0; i < aRequiredTextFieldsKeys.length; i++) {
var el = element(by.model('oFormData.' + aRequiredTextFieldsKeys[i]));
el.sendKeys('a');
checkRequiredClass(el);
}
// email
var elEmail = element(by.model('oFormData.sEmail'));
elEmail.sendKeys('jo#jo.de');
checkRequiredClass(el);
// birthday
var elBirthday = element(by.model('oFormData.oBirthday'));
elBirthday.sendKeys('1.1.1995');
checkRequiredClass(el);
// checkboxes
var elCheck1 = element(by.model('oFormData.bAgb'));
elCheck1.click();
checkRequiredClass(elCheck1);
var elCheck2 = element(by.model('oFormData.bPrivatePolicy'));
elCheck2.click();
checkRequiredClass(elCheck2);
// hack upload bon
ptor.executeScript(function ()
{
var scope = $('#application-form-id').scope();
scope.oFormData.bBonUploaded = true;
});
// submit form
element(by.className('btn-submit')).click();
ptor.getCurrentUrl()
.then(function (url)
{
expect(url).toNotBe(sFormUrl);
});
});
});
But when I launch internet explorer or safari, I get all sorts of errors, while the page works fine when tested manually. For IE I get:
Message:
UnknownError: JavaScript error (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 97
milliseconds Build info: version: '2.30.0', revision: 'dc1ef9c', time:
'2013-02-19 00:15:27' System info: os.name: 'Windows Server 2008 R2',
os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35' Session
ID: 42b30348-8598-4edb-923e-a7019ced6eb0 Driver info:
org.openqa.selenium.ie.InternetExplorerDriver Capabilities
[{platform=WINDOWS, elementScrollBehavior=0, javascriptEnabled=true,
enablePersistentHover=true, ignoreZoomSetting=false,
browserName=internet explorer, enableElementCacheCleanup=true,
unexpectedAlertBehaviour=dismiss, version=10,
cssSelectorsEnabled=true, ignoreProtectedModeSettings=false,
requireWindowFocus=false, allowAsynchronousJavaScript=false,
handlesAlerts=true, initialBrowserUrl=, nativeEvents=true,
takesScreenshot=true}]
Error: Error while waiting for Protractor to sync with the page: {"stack":"TypeError:
Unable to get property 'get' of undefined or null reference\n at Anonymous function (Unknown
script code:25:5)\n at Anonymous function (Unknown script code:21:14)\n at Anonymous
function (Unknown script code:21:2)","description":"Unable to get property 'get' of undefined
or null reference","number":-2146823281}
And for Safari:
UnknownError: Detected a page unload event; script execution does not work across page loads. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 384 milliseconds
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Windows Server 2008 R2', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35'
Session ID: null
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=5.1.7}]
I'm confsued about the reasons. I tried simpler tests with the same results, I tried local and remote urls and I tried all sorts of delays like waitForAngular, wait and ptor ignoreAsynch = true. None of them lead to the desired outcome. Any suggestions?
My protractor config file:
// A reference configuration file.
exports.config = {
seleniumServerJar: null,
seleniumPort: null,
chromeOnly: false,
// Additional command line options to pass to selenium. For example,
// if you need to change the browser timeout, use
// seleniumArgs: ['-browserTimeout=60'],
seleniumArgs: [],
sauceUser: 'saucesuer',
sauceKey: 'key',
allScriptsTimeout: 120000,
specs: [
'test/e2e/**/*.js',
],
// https://code.google.com/p/selenium/wiki/DesiredCapabilities
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path':'node_modules/phantomjs/bin/phantomjs'
},
// Selector for the element housing the angular app - this defaults to
// body, but is necessary if ng-app is on a descendant of <body>
rootElement: 'body',
onPrepare: function ()
{
// driver.manage().timeouts().setScriptTimeout(60000);
},
params: {
sBaseUrl: 'https://dev.com/'
},
baseUrl: 'http://localhost:8000',
framework: 'jasmine',
// ----- Options to be passed to minijasminenode -----
//
// See the full list at https://github.com/juliemr/minijasminenode
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 120000
}
};
WHile it doesnt seem to matter, I use grunt-protractor runner to run multiple instances sequentially.
chrome: {
options: {
args: {
browser: 'chrome',
"idle-timeout": 120
}
}
},
firefox: {
options: {
args: {
browser: 'firefox'
}
}
},
ie9: {
options: {
args: {
browser: 'internet explorer',
version: '9',
"idle-timeout": 120
}
}
},
ie10: {
options: {
args: {
browser: 'internet explorer',
version: '10'
}
}
},
safari7: {
options: {
args: {
browser: 'safari',
version: '7'
}
}
},
safari6: {
options: {
args: {
browser: 'safari',
version: '6'
}
}
},
safari5: {
options: {
args: {
browser: 'safari',
version: '5'
}
}
}
}
grunt.registerTask('e2eall', [
'protractor:ie9',
'protractor:ie10',
'protractor:safari5',
'protractor:safari6',
'protractor:safari7',
'protractor:firefox',
'protractor:chrome'
]);
Hugo,
This is an issue with certain test configurations that was partially solved in Protractor 0.17 and more definitively solved in 0.18. I would recommend updating your protractor to latest (0.18.1 at the time of this post) and seeing if that solves your issue.
Relevant changelog entries:
v0.18
(10aec0f) fix(pageload): increase wait timeout
The 300 ms wait caused problems when testing IE on Sauce Labs. It seems way too short. "browser.get()" invariably timed out. Increasing it solved our problem.
v0.17
(a0bd84b) fix(pageload): add a wait during protractor.get() to solve unload issues
Some systems would not wait for the browser unload event to finish before beginning the asynchronous script execution.
Closes #406. Closes #85.
Hope that helps!

Resources