|
Rank: Newbie Groups: Member
Joined: 1/25/2014 Posts: 2
|
Hi,
I am really happy to see the feature-set so far of EO.WebBrowser and I am planning to use it in my WinForm application becuase .NET's WebBrowser control is not 'so good' !
So what I want is to achieve Chrome's Inspect Element like functionality , I want to select any html element on loaded site like Chrome's Inspect Element does on Mouse Over/Hover and on click select it and return the selected element to my .NET code.
Can I do this and little guidance on how to do this ?
Thanks, Tony
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
Hi, There is no built-in support for HTML Inspector on EO.WebBrowser. However it is possible for you to use the JavaScript extension feature to "notify" your .NET side code from your JavaScript code so that you can pass whatever information from JavaScript to your .NET code whenever needed. You can then implement whatever logic you have in mind based on this. Note this method requires you to add the corresponding JavaScript code in your page. You can find more information about the JavaScript extension feature here: http://www.essentialobjects.com/doc/6/advanced/jsext.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/25/2014 Posts: 2
|
Ok. Thanks.
And If I want to get HTML of current clicked element in Webview , can I do this using .NET API ? And one more thing is there any builtin mechanism to know when page is 'completely' loaded . I can see there is IsLoadingChanged event but if I just want to know when complete page is download so I could register my click event or any other event to page.
Tony.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
Hi, Our API allows you to call JavaScript code from your .NET code (WebView.EvalScript) and allow you to call .NET code from JavaScript code (EO.extInvoke). Anything between .NET and JavaScript are done through these two mechanism. For example, you can do something like this in .NET:
Code: C#
WebView1.EvalScript("document.getElementById('button1').onclick=function(){EO.extInvoke('button1_click')};");
After this call the clicking "button1" will call EO.extInvoke("button1_click"). You can then handle this on your .NET side through JSExtInvoke event. If you use the latest version, you can do this to wait for the load the complete:
Code: C#
WebView1.LoadUrl(url).WaitOne();
As soon as this call returns, you can register your click event. Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/4/2017 Posts: 10
|
Hello,
To further extend this topic, is it possible to combine this with the devtools console? It's really nice to load the devtools into a separate window, but one of the main features in chrome is that I can right-click anywhere in the browser, choose 'inspect element...' and the dev console jumps to the corresponding element in the source.
I would like to recreate that feature, to make my debugging life easier. Has anyone attempted this, or is it even possible to interact with the devtools console?
Kind regards, Paul
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
Unfortunately no. This is not currently supported. There is no way to interact with the DevTools console programmatically in the current version. Sorry about it!
|
|