使用AngleSharp,nuget添加引用即可
代码参考:
var html="<div>aaa</div><div>bbb</div>";
var config = new Configuration().WithJs();
IBrowsingContext context = BrowsingContext.New(config);
IDocument document = await context.OpenAsync(req => req.Content(html));
var sels = document.QuerySelectorAll("div").ToList();
不懂的评论我,欢迎打赏
![](https://i-blog.csdnimg.cn/blog_migrate/41856556c5d9d44a54e9db02c6d2f679.png)