ChromeOptions options = new ChromeOptions();
options.AddArgument("headless");//Comment if we want to see the window.
var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);
driver.Navigate().GoToUrl("https://www.google.com");
var screenshot = (driver as ITakesScreenshot).GetScreenshot();
screenshot.SaveAsFile(@"D:\SeleniumTestingScreenshot.jpg", ImageFormat.Jpeg);
driver.Close();
driver.Quit();
options.AddArgument("headless");//Comment if we want to see the window.
var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);
driver.Navigate().GoToUrl("https://www.google.com");
var screenshot = (driver as ITakesScreenshot).GetScreenshot();
screenshot.SaveAsFile(@"D:\SeleniumTestingScreenshot.jpg", ImageFormat.Jpeg);
driver.Close();
driver.Quit();