Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do not merge] add webinspector mobile command for development #1455

Closed
wants to merge 2 commits into from

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Nov 27, 2022

this is for dev purpose right now

# Ruby client
@driver.execute_script 'mobile:webInspector', {method: 'Page.reload'}

Then, the server had (for a simulator):

[HTTP] --> POST /wd/hub/session/e8676215-b4c7-4dd5-af73-26e8330c35f8/execute/sync
[HTTP] {"script":"mobile:webInspector","args":[{"method":"Page.reload"}]}
[debug] [XCUITestDriver@dc5d (e8676215)] Calling AppiumDriver.execute() with args: ["mobile:webInspector",[{"method":"Page.reload"}],"e8676215-b4c7-4dd5-af73-26e8330c35f8"]
[debug] [XCUITestDriver@dc5d (e8676215)] Executing command 'execute'
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:12456', page '1', target 'page-18' (id: 38): 'Page.reload'
[debug] [ios-device] Sending message to Web Inspector:
[debug] [ios-device] {
[debug] [ios-device]   "__argument": {
[debug] [ios-device]     "WIRSocketDataKey": "{\"method\":\"Target.sendMessageToTarget\",\"params\":{\"targetId\":\"page-18\",\"message\":\"{\\\"id\\\":38,\\\"method\\\":\\\"Page.reload\\\",\\\"params\\\":{\\\"objectGroup\\\":\\\"console\\\",\\\"includeCommandLineAPI\\\":true,\\\"doNotPauseOnExceptionsAndMuteConsole\\\":false,\\\"emulateUserGesture\\\":false,\\\"generatePreview\\\":false,\\\"saveResult\\\":false}}\"},\"id\":39}",
[debug] [ios-device]     "WIRConnectionIdentifierKey": "7590b918-572f-42bd-b2a4-a88d5e41670b",
[debug] [ios-device]     "WIRSenderKey": "7ab531a7-3002-4cf3-b318-b6c6db708654",
[debug] [ios-device]     "WIRApplicationIdentifierKey": "PID:12456",
[debug] [ios-device]     "WIRPageIdentifierKey": 1
[debug] [ios-device]   },
[debug] [ios-device]   "__selector": "_rpc_forwardSocketData:"
[debug] [ios-device] }
[debug] [ios-device] Received message from Web Inspector:
[debug] [ios-device] {
[debug] [ios-device]   "__argument": {
[debug] [ios-device]     "WIRApplicationIdentifierKey": "PID:12456",
[debug] [ios-device]     "WIRMessageDataTypeKey": "WIRMessageDataTypeFull",
[debug] [ios-device]     "WIRDestinationKey": "7ab531a7-3002-4cf3-b318-b6c6db708654",
[debug] [ios-device]     "WIRMessageDataKey": "{\"result\":{},\"id\":39}"
[debug] [ios-device]   },
[debug] [ios-device]   "__selector": "_rpc_applicationSentData:"
[debug] [ios-device] }
[debug] [ios-device] Received message from Web Inspector:
[debug] [ios-device] {
[debug] [ios-device]   "__argument": {
[debug] [ios-device]     "WIRApplicationIdentifierKey": "PID:12456",
[debug] [ios-device]     "WIRMessageDataTypeKey": "WIRMessageDataTypeFull",
[debug] [ios-device]     "WIRDestinationKey": "7ab531a7-3002-4cf3-b318-b6c6db708654",
[debug] [ios-device]     "WIRMessageDataKey": "{\"method\":\"Target.dispatchMessageFromTarget\",\"params\":{\"targetId\":\"page-18\",\"message\":\"{\\\"result\\\":{},\\\"id\\\":38}\"}}"
[debug] [ios-device]   },
[debug] [ios-device]   "__selector": "_rpc_applicationSentData:"
[debug] [ios-device] }
[debug] [RemoteDebugger] Received data response from send (id: 38): '{}'
[debug] [RemoteDebugger] Sending to Web Inspector took 44ms
[debug] [XCUITestDriver@dc5d (e8676215)] Responding to client with driver.execute() result: true
[HTTP] <-- POST /wd/hub/session/e8676215-b4c7-4dd5-af73-26e8330c35f8/execute/sync 200 48 ms - 14
[HTTP]
[debug] [ios-device] Received message from Web Inspector:
[debug] [ios-device] {
[debug] [ios-device]   "__argument": {
[debug] [ios-device]     "WIRApplicationIdentifierKey": "PID:12456",
[debug] [ios-device]     "WIRListingKey": {
[debug] [ios-device]       "1": {
[debug] [ios-device]         "WIRTitleKey": "YouTube",
[debug] [ios-device]         "WIRTypeKey": "WIRTypeWebPage",
[debug] [ios-device]         "WIRURLKey": "https://m.youtube.com/",
[debug] [ios-device]         "WIRPageIdentifierKey": 1,
[debug] [ios-device]         "WIRConnectionIdentifierKey": "7590b918-572f-42bd-b2a4-a88d5e41670b"
[debug] [ios-device]       }
[debug] [ios-device]     }
[debug] [ios-device]   },
[debug] [ios-device]   "__selector": "_rpc_applicationSentListing:"
[debug] [ios-device] }
[debug] [RemoteDebugger] Page changed: {
[debug] [RemoteDebugger]   "1": {
[debug] [RemoteDebugger]     "WIRTitleKey": "YouTube",
[debug] [RemoteDebugger]     "WIRTypeKey": "WIRTypeWebPage",
[debug] [RemoteDebugger]     "WIRURLKey": "https://m.youtube.com/",
[debug] [RemoteDebugger]     "WIRPageIdentifierKey": 1,
[debug] [RemoteDebugger]     "WIRConnectionIdentifierKey": "7590b918-572f-42bd-b2a4-a88d5e41670b"
[debug] [RemoteDebugger]   }
[debug] [RemoteDebugger] }
[debug] [XCUITestDriver@dc5d (e8676215)] Remote debugger notified us of a new page listing: {"appIdKey":"12456","pageArray":[{"id":1,"title":"YouTube","url":"https://m.youtube.com/","isKey":true}]}
[debug] [XCUITestDriver@dc5d (e8676215)] Checking if page needs to load
[debug] [XCUITestDriver@dc5d (e8676215)] New page listing is same as old, doing nothing
[debug] [ios-device] Received message from Web Inspector:
[debug] [ios-device] {
[debug] [ios-device]   "__argument": {
[debug] [ios-device]     "WIRApplicationIdentifierKey": "PID:12456",
[debug] [ios-device]     "WIRListingKey": {
[debug] [ios-device]       "1": {
[debug] [ios-device]         "WIRTitleKey": "Home - YouTube",
[debug] [ios-device]         "WIRTypeKey": "WIRTypeWebPage",
[debug] [ios-device]         "WIRURLKey": "https://m.youtube.com/",
[debug] [ios-device]         "WIRPageIdentifierKey": 1,
[debug] [ios-device]         "WIRConnectionIdentifierKey": "7590b918-572f-42bd-b2a4-a88d5e41670b"
[debug] [ios-device]       }
[debug] [ios-device]     }
[debug] [ios-device]   },
[debug] [ios-device]   "__selector": "_rpc_applicationSentListing:"
[debug] [ios-device] }
[debug] [RemoteDebugger] Page changed: {
[debug] [RemoteDebugger]   "1": {
[debug] [RemoteDebugger]     "WIRTitleKey": "Home - YouTube",
[debug] [RemoteDebugger]     "WIRTypeKey": "WIRTypeWebPage",
[debug] [RemoteDebugger]     "WIRURLKey": "https://m.youtube.com/",
[debug] [RemoteDebugger]     "WIRPageIdentifierKey": 1,
[debug] [RemoteDebugger]     "WIRConnectionIdentifierKey": "7590b918-572f-42bd-b2a4-a88d5e41670b"
[debug] [RemoteDebugger]   }
[debug] [RemoteDebugger] }
[debug] [XCUITestDriver@dc5d (e8676215)] Remote debugger notified us of a new page listing: {"appIdKey":"12456","pageArray":[{"id":1,"title":"Home - YouTube","url":"https://m.youtube.com/","isKey":true}]}
[debug] [XCUITestDriver@dc5d (e8676215)] Checking if page needs to load
[debug] [XCUITestDriver@dc5d (e8676215)] New page listing is same as old, doing nothing

with appium/appium-remote-debugger#274

Not sure which is better, the Page.reload vs atom's reload, but this is an example of this command for dev purpose.
With safariLogAllCommunication: true option, we can easily try to send commands to observe the event in Appium's log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant