c#OpenQA.Selenium 如何给指定元素截图,比如截图获取二维码,
1.获取指定元素节点
var image = driver.FindElementById("CheckCode");
2.使用ITakesScreenshot获取截图并保存
Screenshot screenshot = ((ITakesScreenshot)image).GetScreenshot();
screenshot.SaveAsFile(LoginScreenPath);
c#OpenQA.Selenium 如何给指定元素截图,比如截图获取二维码,
1.获取指定元素节点
var image = driver.FindElementById("CheckCode");
2.使用ITakesScreenshot获取截图并保存
Screenshot screenshot = ((ITakesScreenshot)image).GetScreenshot();
screenshot.SaveAsFile(LoginScreenPath);