Skip to content Skip to sidebar Skip to footer

How Can I Execute Javascript Function In C# Or Wpf

I'm using C# .net 4.5 with VS2015 and try to do scraping the website. HTML table to data. For the web browser control using winform C# one, because I heard that one has more featur

Solution 1:

The javascript:pageObj.sendPage('21'); is a url which you can navigate to. The web-browser doesn't actually navigate to the script, instead it executes the script. So you can simply use Navigate method of WebBrowserControl:

this.webBrowser1.Navigate("javascript:pageObj.sendPage('21');");

Solution 2:

I invoke javascript via web browser control of WPF by the below command:

string ScriptName = "sendPage";
string ID = "21";
this.WebBrowserPage.InvokeScript(ScriptName, ID);

Post a Comment for "How Can I Execute Javascript Function In C# Or Wpf"