|
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?
|
|
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.aspxFor most interaction you will need to rely on JavaScript and EvalScript. Thanks!
|
|
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.
|
|
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!
|
|
Rank: Newbie Groups: Member
Joined: 5/12/2020 Posts: 2
|
It helps! Thank you
|
|
Rank: Member Groups: Member
Joined: 9/29/2019 Posts: 13
|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Clarence,
Please see our previous reply to OneData.
Thanks!
|
|