Implement GetPageSource() and GetPageText()

This commit is contained in:
Tobias Taschner
2020-01-17 10:08:58 +01:00
parent ce968d0ecb
commit fb0e82e9d1
2 changed files with 7 additions and 5 deletions

View File

@@ -285,7 +285,7 @@ public:
<a href="https://docs.microsoft.com/en-us/microsoft-edge/hosting/webview2">Edge WebView2</a>. <a href="https://docs.microsoft.com/en-us/microsoft-edge/hosting/webview2">Edge WebView2</a>.
It is available for Windows 7 and newer. It is available for Windows 7 and newer.
The following features are currently unsupported with this backend: The following features are currently unsupported with this backend:
virtual filesystems, custom urls, find, source code. virtual filesystems, custom urls, find.
This backend is not enabled by default, to build it follow these steps: This backend is not enabled by default, to build it follow these steps:
- Visual Studio 2015, or newer, is required - Visual Studio 2015, or newer, is required

View File

@@ -492,14 +492,16 @@ void wxWebViewEdge::Reload(wxWebViewReloadFlags WXUNUSED(flags))
wxString wxWebViewEdge::GetPageSource() const wxString wxWebViewEdge::GetPageSource() const
{ {
// TODO: not implemented in SDK (could probably be implemented by script) wxString text;
return wxString(); const_cast<wxWebViewEdge*>(this)->RunScript("document.documentElement.outerHTML;", &text);
return text;
} }
wxString wxWebViewEdge::GetPageText() const wxString wxWebViewEdge::GetPageText() const
{ {
// TODO: not implemented in SDK (could probably be implemented by script) wxString text;
return wxString(); const_cast<wxWebViewEdge*>(this)->RunScript("document.body.innerText;", &text);
return text;
} }
bool wxWebViewEdge::IsBusy() const bool wxWebViewEdge::IsBusy() const