HtmlAgilityPack LoadFromBrowser method not found

html-agility-pack

Question

I am using HtmlAgilityPack 1.6.2 within a .NET Core 2.0 Console application. HtmlWeb.Load function works fine but LoadFromBrowser function is not available. I got a compiler error. The testing code is copied from the tutorial page so it should be correct. Please advise how to use the API.

Expert Answer

The LoadFromBrowser method requires the WinForm WebBrowser to work.

Since there is not WebBrowser in .NET Core 2.0, this method is not available.

This method could be available in the future by replacing the WebBrowser by an open source browser but there is currently no short-term plan for it.

EDIT: Answer comment

Is there still no solution for this?

I didn't try it, but some package support web browser for .NET Standard such as : https://www.nuget.org/packages/Selenium.WebDriver

So perhaps if you use this package to retrieve the HTML and use it with HAP, that will work.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why