Welcome Guest Search | Active Topics | Sign In | Register

WebBrowser.Document Options
Clarence
Posted: Thursday, May 14, 2020 7:37:36 AM
Rank: Member
Groups: Member

Joined: 9/29/2019
Posts: 13
I'm using WPF and using WebView and WebControl to load URL.
How do I get the HTML document? I did see example webBrowser.Document, where do I get webBrowser parent object from WebView or WebControl?
eo_support
Posted: Thursday, May 14, 2020 9:18:52 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Please see here for more details:

https://www.essentialobjects.com/doc/webbrowser/advanced/jsdom.aspx

For most interaction you will need to rely on JavaScript and EvalScript.

Thanks!
OneData
Posted: Thursday, May 14, 2020 2:29:00 PM
Rank: Newbie
Groups: Member

Joined: 5/12/2020
Posts: 2
Hi,

I have the same problem with using webcontrol with winform. Ther no way to access the HTML document.
If I follow the instructions at https://www.essentialobjects.com/doc/webbrowser/advanced/jsdom.aspx, "Dim doc As HtmlDocument = WebControl1.WebView.document", it returns me a BC30456 error: 'document' is not a 'WebView' member.

Thank you.
eo_support
Posted: Thursday, May 14, 2020 5:24:58 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
OneData wrote:
Hi,

I have the same problem with using webcontrol with winform. Ther no way to access the HTML document.
If I follow the instructions at https://www.essentialobjects.com/doc/webbrowser/advanced/jsdom.aspx, "Dim doc As HtmlDocument = WebControl1.WebView.document", it returns me a BC30456 error: 'document' is not a 'WebView' member.

Thank you.


Hi,

The sample code is wrong and has not been properly updated. Below is the correct code:

Code: Visual Basic.NET
'Get the window object
Dim window As EO.WebBrowser.DOM.Window = webView.GetDOMWindow()

'Get the document
Dim doc As EO.WebBrowser.DOM.Document = window.document

'Get the button
Dim button As EO.WebBrowser.DOM.Element = doc.getElementById("Button1")

'Click the button
button.InvokeFunction("click")


Hope this helps.

Thanks!
OneData
Posted: Thursday, May 14, 2020 5:46:57 PM
Rank: Newbie
Groups: Member

Joined: 5/12/2020
Posts: 2
It helps! Thank you
Clarence
Posted: Thursday, May 14, 2020 6:01:26 PM
Rank: Member
Groups: Member

Joined: 9/29/2019
Posts: 13
eo_support wrote:
Hi,

Please see here for more details:

https://www.essentialobjects.com/doc/webbrowser/advanced/jsdom.aspx

For most interaction you will need to rely on JavaScript and EvalScript.

Thanks!


In https://www.essentialobjects.com/doc/webbrowser/advanced/jsdom.aspx,
HtmlDocument doc = WebBrowser1.Document;

I tried HtmlDocument Doc=WebView.GetDOMWindow().document and get the error "Cannot convert DOMDocument to HtmlDocument" error.
Even an explicit cast doesn't work, i.e. HtmlDocument Doc=(HtmlDocument)WebView.GetDOMWindow().document.

Thus, the question is still how can I access WebBrowser.Document?
I assumed WebBrowser contains WebControl and has many WebViews?


eo_support
Posted: Friday, May 15, 2020 9:15:17 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Clarence,

Please see our previous reply to OneData.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.