//SCREENSHOT DE ELEMENTOS public void ScreenshotTabCat(string imgName, string vlr1) { IJavaScriptExecutor je = (IJavaScriptExecutor)_driver; wait.Until(ExpectedConditions.ElementExists(By.XPath("/html/body/a/div/table/tbody"))); var rows = TabCat.FindElements(By.TagName("tr")).Count; for (int c = 1; c <= rows; c++) { IWebElement tdElement = TabCat.FindElement(By.XPath("//tr[" + c + "]/td[1]")); string td = tdElement.GetAttribute("innerText"); if (td.Equals(vlr1)) { je.ExecuteScript("arguments[0].scrollIntoView(true);", tdElement); break; } } ITakesScreenshot camera = _driver as ITakesScreenshot; try { Screenshot ss = camera.GetScreenshot(); ss.SaveAsFile(PathScrenShotGet.PathScrenShot() + imgName + " Teste " + contador++ + ".jpg"); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }
//SCREENSHOT DE RESULTADOS public void Screenshot(string imgName) { ITakesScreenshot camera = _driver as ITakesScreenshot; try { Screenshot ss = camera.GetScreenshot(); ss.SaveAsFile(PathScrenShotGet.PathScrenShot() + imgName + " Teste " + contador++ + ".jpg"); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }