nemocean
nemocean

Reputation: 179

Calling javascript method on html page, loaded in C#

Is it possible? I mean, I have loaded html page (with HtmlAgilityPack for example) and javascript file. I need to apply javascript method from this file (or whole javascript file) to my loaded html page and do this from C# code. Then save result html to filesystem. Can I do that?

Upvotes: 1

Views: 2273

Answers (2)

Charles Boyung
Charles Boyung

Reputation: 2481

If this is a winforms app, you might be able to use the web browser control to load the page (which should then fire the javascript) and then try to scrape the resulting HTML from the page.

Upvotes: 0

Oded
Oded

Reputation: 499182

You will need to use a headless browser to apply the javascript to the page first.

See this SO question about headless browsers for .NET - there should be something suitable.

Upvotes: 1

Related Questions