【发布时间】:2020-06-07 06:41:22
【问题描述】:
我已经看到 html 敏捷包可以派上用场,但我不明白它是如何工作的。这就是我现在获取代码的方式,目前它成功提取了标题内容,但也获取了更多不需要的内容。
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl(response);
String sourcePage = driver.PageSource;
Regex regexHeadings = new Regex("(?<=\\>)(?!\\<)(.*)(?=\\<)(?<!\\>)");
foreach (Match match in regexHeadings.Matches(sourcePage))
{
h1Keywords.Add(match.Value);
colorOutput(ConsoleColor.White, match.Value);
}
【问题讨论】:
标签: c# selenium html-agility-pack