Attempting to parse HTML using AngleSharp and running into issues with https://opensource.org/licenses/MS-PL
The following code is returning '0' while running in Linqpad
var url = @"https://opensource.org/licenses/MS-PL";
var doc = await AngleSharp.BrowsingContext.New().OpenAsync(url);
doc.Body.ChildElementCount.Dump();
I would expect the full HTML to come back as part of the body. Any ideas?
When creating a new BrowsingContext
without supplying an IConfiguration
, it uses a default config that does not support document loading. You need to create a config that does and pass it to the BrowsingContext.New
.
var config = Configuration.Default.WithDefaultLoader();
var doc = await AngleSharp.BrowsingContext.New(config).OpenAsync(url);