public void SaveScreenshotWithHighlightedElement(string filename) { var driver = Browser.GetInstance().GetDriver(); var js = (IJavaScriptExecutor)driver; var element = GetElement(); var bgcolor = element.GetCssValue("backgroundColor"); js.ExecuteScript("arguments[0].style.backgroundColor = '" + "red" + "'", element); new AShot().ShootingStrategy(new ViewportPastingStrategy(100)) .TakeScreenshot(driver) .getImage() .Save(Path.Combine(FileProvider.GetOutputDirectory(), $"{filename}_{DateTime.Now.ToFileTime()}.png")); js.ExecuteScript("arguments[0].style.backgroundColor = '" + bgcolor + "'", element); }
private LoggingConfiguration GetConfiguration() { var layout = "${date:format=yyyy-MM-dd HH\\:mm\\:ss} ${level:uppercase=true} - ${message}"; var config = new LoggingConfiguration(); var fileName = Path.Combine(FileProvider.GetOutputDirectory(), "log.log"); if (File.Exists(fileName)) { File.Delete(fileName); } config.AddRule(LogLevel.Info, LogLevel.Fatal, new ConsoleTarget("logconsole") { Layout = layout }); config.AddRule(LogLevel.Debug, LogLevel.Fatal, new FileTarget("logfile") { FileName = fileName, Layout = layout }); return(config); }
public static string GetLogLocation() { return(Path.Combine(FileProvider.GetOutputDirectory(), "log.log")); }