-
Notifications
You must be signed in to change notification settings - Fork 55
Can't get result from CallDevToolsProtocolMethodAsync #304
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
Comments
Not the same for all calls, "Network.getCookies", does work. |
It seems that ParametersAsJson may be the problem, I don't seem to be able to get a response when they are required. This works: Returns an empty array: |
For the cookies try adding the protocol. That works for me. For the DOM.getOuterHTML I haven't had any luck yet. CoreWeb.CallDevToolsProtocolMethodAsync("Network.getCookies", "{""urls"":[""https://google.co.uk"",""https://www.google.com""]}") |
@michael-russin Cheers, didn't think of that. I was going on .Net where only domain is required. |
PS: I did try adding nodeId for getOuterHTML but nothing from that either. |
Thanks for bringing this up - we have been investigating this and trying to determine if this is a bug on our side or a bug in CDP |
This appears to be a bug on CDP side. I'll file a bug for them to look into and I've added a feature request on our end to provide better error messaging. |
@pagoe-msft Great, thanks. While we're on better error messaging, is there any way to log executeScriptAsync errors in devtools? |
We don't have support for that right now - but that's a really interesting feature request. Could you open a new issue for that, so we can track it separately in our backlog? |
@pagoe-msft will do |
You can get the getOuterHTML working by making 2 calls // Get the document information
CoreWebView2.CallDevToolsProtocolMethodAsync("DOM.getDocument", "{}");
// parse the result JSON and read the nodeId
// get the outer html for the nodeId
CoreWebView2.CallDevToolsProtocolMethodAsync("DOM.getOuterHTML", "{\"nodeId\" : " + nodeId + "}"); This will give the source you would see by doing an Inspect not what you would see with a View Source. A basic sample can be found in the WebView2WindowsFormsBrowser project at https://github.com/michael-russin/WebView2Samples |
@michael-russin Thanks, that is what I wanted to find out. Is it just |
@ukandrewc Apparently even though the docs for getOuterHTML list all parameters as optional, at least one needs to be specified. |
Great, thanks. |
If you specify {"nodeId":1} |
Sorry my bad // Get the document information //var id = parse using a System.Text.RegularExpressions.Regex // get the outer html for the nodeId and you get all the view Source of the HTML document html-decoded |
Trying to call devtools protocol but not getting any results, I have Dev channel installed
AB#27258673
The text was updated successfully, but these errors were encountered: