I want to take h
p
and img
element from HTML page but I didn't find how can I do this on anglesharp
.I can take all p tags but I want to take all p h and img
element respectively.
I can take like this :
var config = Configuration.Default.WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync("any_site");
var elements = document.Body.QuerySelectorAll("p");
I try this but does not work
var elements = document.Body.QuerySelectorAll("p h1 h2 h3 h4 h5 img");
How can I do this ?
Use a comma to separate different selections:
Just having a space is the descendants selector, which looks in the pool of children and their children recursively.