Link to home
Start Free TrialLog in
Avatar of trevor1940
trevor1940

asked on

C#: Using alternate web browser on Win Forms

Hi
I'm tryingg to build a winforms app that uses the built in web browser

On loading a JavaScript hungry HTML5  page I get a number of error boxes similar to the image

User generated image
Google suggested doing this which didn't work   (Even running the "...\debug\AppName.exe" in admin mode allowed the regestry to be set but failed to load the page correctly

More googling suggested using the nuget package Geckofx60.64


I'm struggling to know how to install this as there are several when searching for Geckofx

I'm also unsure how to run even the simple example given

 [STAThread]
       static void Main(string[] args)
       {
           Xpcom.Initialize("Firefox64");
           var geckoWebBrowser = new GeckoWebBrowser {Dock = DockStyle.Fill};
           Form f = new Form();
           f.Controls.Add(geckoWebBrowser);
           geckoWebBrowser.Navigate("www.google.com");
           Application.Run(f);
       }

Open in new window


Could someone start me of?

in my App I need to have real browser with at least 1 button that is used after the page loads to analyse the page using xpath queries
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of trevor1940
trevor1940

ASKER

Hi

Could you give me a clue how to set this up?
Download the sample project
The problem is your "built in web browser" has problems processing some or all Javascript.

CefSharp is more of a Windows specific (code will never run anywhere else) solution.

Use http://phantomjs.org/ if you'd like your code to run on any OS.
Downloaded Sample project
set CefSharp.Test as starup file
build caused a whole host of errors

"Severity      Code      Description      Project      File      Line      Suppression State
Error      CS0117      'TaskCreationOptions' does not contain a definition for 'RunContinuationsAsynchronously'      CefSharp.OffScreen.Example      D:\Vb\Test\CefSharp-master\CefSharp.OffScreen.Example\Program.cs      119      Active
"

have no clue what these mean or if i've done it wrong there dosn't seem to be an install guide

I'm unlikely to run this outside windows but will   try http://phantomjs.org/  tomorrow hopefully it will be a tad more straight forward
Best to open a ticket with CefSharp or post to one of their user forums for assistance with this.
Hi
I managed to get this to work This Tutorial

For anyone else reading this where it said edit *.csproj and App.config files I did it with Visual Studio closed using an external xml / text editor
AT 2B I had to add new CPU and use  x86

Gave up on the download examples