appium / appium-remote-debugger

Module for dealing with Remote Debugger protocol
Apache License 2.0
44 stars 32 forks source link

fix: Only wait for Console.enable RPC response if page load finishes #360

Closed mykola-mokhnach closed 7 months ago

KazuCocoa commented 7 months ago

hm, with this PR, no longer error occurred with the Console.enable and the following commands did not function. (no safari page load occurred on the GUI, no response for driver.title etc)

[HTTP] --> POST /session/294e0880-a446-4125-a2ab-b3c56660ee78/url
[HTTP] {"url":"https://rakuten.co.jp"}
[debug] [XCUITestDriver@a2a6 (294e0880)] Calling AppiumDriver.setUrl() with args: ["https://rakuten.co.jp","294e0880-a446-4125-a2ab-b3c56660ee78"]
[debug] [XCUITestDriver@a2a6 (294e0880)] Executing command 'setUrl'
[debug] [XCUITestDriver@a2a6 (294e0880)] Attempting to set url 'https://rakuten.co.jp'
[debug] [RemoteDebugger] Navigating to new URL: 'https://rakuten.co.jp'
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:10456', page '1', target 'page-119' (id: 90): 'Page.navigate'
[debug] [RemoteDebugger] Received data response from send (id: 90): '{}'
[debug] [RemoteDebugger] Sending to Web Inspector took 512ms
[debug] [RemoteDebugger] Received page change notice for app 'PID:10456' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] The page https://rakuten.co.jp is ready in 4761ms
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:10456', page '1', target 'page-119' (id: 92): 'Console.enable'
[debug] [RemoteDebugger] Received data response from send (id: 92): '{}'
[debug] [RemoteDebugger] Sending to Web Inspector took 216ms
[debug] [XCUITestDriver@a2a6 (294e0880)] Responding to client with driver.setUrl() result: null
[HTTP] <-- POST /session/294e0880-a446-4125-a2ab-b3c56660ee78/url 200 4981 ms - 14
[HTTP]
[HTTP] --> POST /session/294e0880-a446-4125-a2ab-b3c56660ee78/url
[HTTP] {"url":"https://rakuten.co.jp"}
[debug] [XCUITestDriver@a2a6 (294e0880)] Calling AppiumDriver.setUrl() with args: ["https://rakuten.co.jp","294e0880-a446-4125-a2ab-b3c56660ee78"]
[debug] [XCUITestDriver@a2a6 (294e0880)] Executing command 'setUrl'
[debug] [XCUITestDriver@a2a6 (294e0880)] Attempting to set url 'https://rakuten.co.jp'
[debug] [RemoteDebugger] Navigating to new URL: 'https://rakuten.co.jp'
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:10456', page '1', target 'page-119' (id: 94): 'Page.navigate'
[debug] [RemoteDebugger] Received data response from send (id: 94): '{}'
[debug] [RemoteDebugger] Sending to Web Inspector took 921ms
[RemoteDebugger] Timed out after 6000ms of waiting for the https://rakuten.co.jp page readiness. Continuing anyway
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:10456', page '1', target 'page-119' (id: 96): 'Console.enable'

# no response from here

[debug] [RemoteDebugger] Sending to Web Inspector took 4ms
[debug] [XCUITestDriver@a2a6 (294e0880)] Responding to client with driver.setUrl() result: null
[HTTP] <-- POST /session/294e0880-a446-4125-a2ab-b3c56660ee78/url 200 6009 ms - 14
[HTTP]
[HTTP] --> POST /session/294e0880-a446-4125-a2ab-b3c56660ee78/url
[HTTP] {"url":"https://rakuten.co.jp"}
[debug] [XCUITestDriver@a2a6 (294e0880)] Calling AppiumDriver.setUrl() with args: ["https://rakuten.co.jp","294e0880-a446-4125-a2ab-b3c56660ee78"]
[debug] [XCUITestDriver@a2a6 (294e0880)] Executing command 'setUrl'
[debug] [XCUITestDriver@a2a6 (294e0880)] Attempting to set url 'https://rakuten.co.jp'
[debug] [RemoteDebugger] Navigating to new URL: 'https://rakuten.co.jp'
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:10456', page '1', target 'page-119' (id: 98): 'Page.navigate'
[RemoteDebugger] Timed out after 6000ms of waiting for the https://rakuten.co.jp page readiness. Continuing anyway
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:10456', page '1', target 'page-119' (id: 100): 'Console.enable'
[debug] [RemoteDebugger] Sending to Web Inspector took 6ms
[debug] [XCUITestDriver@a2a6 (294e0880)] Responding to client with driver.setUrl() result: null
[HTTP] <-- POST /session/294e0880-a446-4125-a2ab-b3c56660ee78/url 200 6011 ms - 14
KazuCocoa commented 7 months ago

Just a note: it looks like Safari browser's GUI blinked when this behavior occurred. I guess Safari process itself got something like refreshed, restarted internally etc...?

mykola-mokhnach commented 7 months ago

I would say the above behaviour is ok. It is anyway better in comparison to complete blocking. We may also consider reporting an issue to Apple about that

github-actions[bot] commented 7 months ago

:tada: This PR is included in version 11.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: