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

Read live HTML content of displayed webpage #40

Open
verelpode opened this issue Aug 19, 2019 · 3 comments
Open

Read live HTML content of displayed webpage #40

verelpode opened this issue Aug 19, 2019 · 3 comments
Labels
feature request feature request priority-low We have considered this issue and decided that we will not be able to address it in the near future. tracked We are tracking this work internally.

Comments

@verelpode
Copy link

verelpode commented Aug 19, 2019

Can WebView2 support something like WebView.CaptureSelectedContentToDataPackageAsync but with an additional option to choose whether it captures the entire webpage versus only the selected portion of the webpage? For troubleshooting purposes, we would find it useful to be able to capture and analyze the HTML of the entire webpage, in order to figure out what's going wrong when a malfunction is reported by users.

I do realize that I can directly download the URL by myself using Windows.Web.Http.HttpClient but that's not the same thing because that effectively downloads the "source code" instead of the current live content of the webpage. JavaScript in the webpage is capable of making many modifications to the webpage, thus there can be a big difference between what HttpClient obtains and what is actually displayed in the WebView2.

Ofcourse the original intention of CaptureSelectedContentToDataPackageAsync is to support copy & paste scenarios, and this is also a valid usage of this feature. If this feature is already supported for capturing the selected portion of the page, then it seems like very little work to create an option to make it capture the entire page.

I think some other issues are much higher priority than this issue, but this feature would still be useful, even if it's not the most important thing currently.

AB#28476423

@david-risney david-risney added the feature request feature request label Aug 20, 2019
@david-risney
Copy link
Contributor

david-risney commented Aug 20, 2019

Can you use IWebView2WebView::ExecuteScript to do this? By which I mean running some script that turns whatever portion of the DOM you like into a string and returning it back?

@verelpode
Copy link
Author

@david-risney -- Although that's a smart idea and I'll keep it in mind, I think the answer is No, it doesn't fully replace CaptureSelectedContentToDataPackageAsync because ExecuteScript returns a string and would only allow HTML to be retrieved, not images, whereas CaptureSelectedContentToDataPackageAsync also captures images.

I just remembered another reason -- a more important reason -- why it should support capturing of the entire page. If it can capture the entire page, then it could be used to implement an external print dialog, in cases where the built-in print dialog cannot be used because it provides excessive access to users. See where I mention CaptureSelectedContentToDataPackageAsync in issue #42.

A similar example is a Kodak photo kiosk, etc. Kiosks similar to that example need to print but it's unacceptable to display the standard Windows print dialog to the kiosk users. Thus an external print dialog is needed, thus the need to capture the entire page (including images), not only the selection, and not only HTML in a string.

@ukandrewc
Copy link

You could do that using https://wkhtmltopdf.org/

@champnic champnic added feature request feature request and removed feature request feature request labels Aug 18, 2020
@champnic champnic added the tracked We are tracking this work internally. label May 10, 2022
@github-actions github-actions bot added the priority-low We have considered this issue and decided that we will not be able to address it in the near future. label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request priority-low We have considered this issue and decided that we will not be able to address it in the near future. tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

4 participants