Skip to content

Debug proxy does not respond when appium session is open #291

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

Closed
debugger89 opened this issue Jan 1, 2019 · 6 comments
Closed

Debug proxy does not respond when appium session is open #291

debugger89 opened this issue Jan 1, 2019 · 6 comments

Comments

@debugger89
Copy link

Im facing the an issue while trying to interact with the debug proxy web service connectivity when there is a Appium web session up and running.

Environment :

Mac Os X 10.14.1
Xcode 10.1
Appium Server 1.10
IOS Simulator : IPhone 5 - 10.3.1

Issue re-production steps

  1. Start an Appium web session in the simulator.
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Safari"); desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS"); desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.3"); desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "10000"); desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 5"); URL url = new URL("http://127.0.0.1:4723/wd/hub"); driver = new IOSDriver(url, desiredCapabilities);
  2. Now try to use the debug proxy web service for getting a screenshot. (The websocket message is sent via a 3rd party chrome extension)
    ws://127.0.0.1:9191/devtools/page/1
    { "id": 1, "method": "Page.startScreencast", "params": { "format": "jpeg" } } {"id":1,"result":{}}

Expected result :

The web socket should receive another message with the screenshot base64 image string.
`
{
"id": 1,
"method": "Page.startScreencast",
"params": {
"format": "jpeg"
}
}

{"id":1,"result":{}}

{
"method": "Page.screencastFrame",
"params": {
"data": "iVBORw0KGgoAAAANSUhEUgAAAUAAAAHMCAYAAACk4......",
"metadata": {
"pageScaleFactor": 2,
"offsetTop": 0,
"deviceWidth": 320,
"deviceHeight": 460,
"scrollOffsetX": 0,
"scrollOffsetY": 0,
"timestamp": "2019-01-01T08:14:17.433Z"
},
"sessionId": 1
}
}
`

Observations

Appium remote debugger log suggests that the message is captured by remote debugger but my websocket client never gets the message.

[RemoteDebugger] Debugger returned data for message '-17' but we were not waiting for that message! result: '{"result":{"type":"string","value":"980,1409,2"},"wasThrown":false}'; error: 'null'

If the appium session is terminated, the above message works without any issue and returns the intended result.

@artygus
Copy link
Collaborator

artygus commented Jan 1, 2019

hi @debugger89 please isolate your problem from appium, it's not clear whether this is appium or iwdp issue right now. can you reproduce it using ios-webkit-dbug-proxy binary only?

@debugger89
Copy link
Author

debugger89 commented Jan 2, 2019

This issue is occuring only when there is Appium session is open as per my knowledge. Which from the backend uses the debug proxy protocol for interacting with the webviews.

@artygus
Copy link
Collaborator

artygus commented Jan 2, 2019

Looked through description a couple of times and I have the following questions:

iwdp shouldn't work with simulators in XCode >= 10 (issue #250). Can you confirm iwpd at least lists simulator as inspectable device? ios_webkit_debug_proxy -l

Im facing the an issue while trying to interact with the debug proxy web service connectivity when there is a Appium web session up and running.

Could you please clarify that sentence. And what do you mean by debug proxy web service connectivity, web service part specifically?

Now try to use the debug proxy web service for getting a screenshot. (The websocket message is sent via a 3rd party chrome extension)

What chrome extension do you use?

And the last thing, did you open the issue in appium? doesn't seem like there's a misbehaviour in proxy job of proxying messages. Screencast commands in chrome and safari protocols has different specs, there're adapters available for bringing back compatibility between dev tools protocols https://github.com/google/ios-webkit-debug-proxy#using-with-devtools

@debugger89
Copy link
Author

debugger89 commented Jan 2, 2019

Here are the steps i have followed.

  1. Start the IWDP. It connects to the simulator on port 9222 port.
    screen shot 2019-01-02 at 4 17 00 pm
  2. Navigate to the http://localhost:9222/json. And following page debug information are listed.
    image
  3. Try to communicate with the page via the websocket whose url is webSocketDebuggerUrl in the given json. Though a Chrome extension

Yes I have logged a issue in Appium. Needed to check if this is a limitation in IWDP where two concurrent users cannot use the service.

@debugger89
Copy link
Author

Update :
I tried the same thing using the https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter but got the same results.

@artygus
Copy link
Collaborator

artygus commented Jan 2, 2019

Okay, now I see what you mean, unfortunately one page can have only one debug session at a time. This is not a proxy limitation, I guess this is a webinsectord limit, can't find a link to any offical source though.

@artygus artygus closed this as completed Jan 2, 2019
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

No branches or pull requests

2 participants