c# selenium 元素截图
通过NuGet安装组件
安装图片所选中的Selenium.WebDriver、Selenium.Support、Selenium.RC即可
打开网页并寻找元素进行元素截图
ps:编写代码之前需确认chromedriver.exe存在不存在,还需确认版本是否和谷歌浏览器符合 (这是个坑,勿踩) chromedriver淘宝镜像下载:http://chromedriver.storage.googleapis.com/index.html
这里只用By.XPath(""); 一个/代表根元素,这里不建议使用,如需使用最好配合XPathHelper插件更好的确定元素。
这里以百度为例,