Switching from webbrowser control to cefsharp

1,137 views
Skip to first unread message

Larry Myers

unread,
Feb 11, 2014, 10:23:24 AM2/11/14
to cefs...@googlegroups.com
Good morning. I am trying to switch from using the webbrowser control, which is basically IE, to using cefsharp.I am using some features of the webbrowser control which I am not finding available for cefsharp, mainly the grabbing of the source of the webpage I have navigated to. Can anyone give me an example of how to add a cefsharp browser and have it be able to grab the source code of the page once the page is loaded? That would be awesome! If not that much can someone just point me to grabbing the HTML source of the page loaded in cefsharp?

Thanks a bunch,
Larry

Larry Myers

unread,
Feb 11, 2014, 11:15:05 AM2/11/14
to cefs...@googlegroups.com
Ok, I have found out how to grab the source code via Dim str As String = web_view.EvaluateScript("document.documentElement.outerHTML"
)
I think I just need to spend some time with this and figure things out a bit more.

Thanks,
Larry

Larry Myers

unread,
Feb 11, 2014, 4:35:14 PM2/11/14
to cefs...@googlegroups.com
Ok I have made one work fine with the WPF version of the control, but I cannot for the life of me figure out how to add it to a winforms app. I found code that seemed to work for them but I cannot get it to work, tried adding it to a panel programatically as well as adding to the form itself via me.controls.add(webview) butn nothing shows the control for me. Can someone provide me with a simple method of adding the control to my form?

Thanks a bunch,
Larry

On Tuesday, February 11, 2014 10:23:24 AM UTC-5, Larry Myers wrote:

Nathan Sizemore

unread,
Feb 11, 2014, 6:36:05 PM2/11/14
to cefs...@googlegroups.com
I'm still pretty new into CefSharp, but are you getting any errors?  Have you set any callback methods to Console.Write to see if the Event Handlers of WebView are being called?
I've only ever applied this to WPF, so I cannot provide any WinForm Examples, but doing the things above seemed to help me out the most to figure out what get fired when during the loading process.  Also, if you check around the in the .cpp files in the WinForms folder of the binaries, you can check out what methods and options are available to you.
This thread may help, the end user seemed to get it working - https://groups.google.com/forum/#!topic/cefsharp/0-pbMrxTLIY

Nathan

Larry Myers

unread,
Feb 12, 2014, 9:44:47 AM2/12/14
to cefs...@googlegroups.com
I appreciate your help!! I have tried numerous times, including the techniques from the link you provided to make it work and am starting to think maybe I should just build it as a WPF instead, at least I can get somewhere with it, just didn't want to learn a new way of doing things, I have been working on forms for a very long time, and always found Windows Phone just a bit hard to get and WPF feels a lot like WP7, so just need to stop being lazy and set down to work on learning this. Just need to port my forms over and I guess go from there. 
Thanks again for your help.
Larry

Nathan Sizemore

unread,
Feb 12, 2014, 9:50:42 AM2/12/14
to cefs...@googlegroups.com
If it makes you feel any better, I'm not a fan of WPF either :)  I'm actually here because of that reason!  I'm using this so that I can deploy a "Native" application to a client, but build the complete GUI with Web Technologies.  Generating charts is absolutely no fun with WPF.

Nathan

Larry Myers

unread,
Feb 12, 2014, 9:59:19 AM2/12/14
to cefs...@googlegroups.com
Actually, it does, I see so many people talking the praises of WPF and xaml and it is almost greek to me, it is so different. I come from the BASIC language and have worked in VB 5 and 6 for a long time before moving to .net, it is so hard to get the feel for everything and to try to convert things from C#, which I barely know.

Generating charts anywhere is not really much fun!!
Thanks,
Larry

Nezir Yeşildağ

unread,
Jun 14, 2016, 4:58:40 PM6/14/16
to CefSharp
May it helps you; http://www.joecolantonio.com/2013/01/18/selenium-webdriver-using-chrome-webdriver-in-visual-studio-c/


12 Şubat 2014 Çarşamba 16:59:19 UTC+2 tarihinde Larry Myers yazdı:
Reply all
Reply to author
Forward
0 new messages