public static void GetScreenShot(BrowserWindow browser) { try { image = browser.CaptureImage(); image.Save(Folderlocation + now.ToString("yyyy-MM-ddss") + ".Jpeg", ImageFormat.Jpeg); } catch (Exception) { } }
public void BrowseWindow_Hook() //Video no 17 { //hook with already existing Browser with title "Execute Automation" BrowserWindow window = BrowserWindow.Locate("Execute Automation"); //Execute Automation is the title of the browser. //From Process //BrowserWindow fromProcess = BrowserWindow.FromProcess(); BrowserWindow.ClearCookies(); BrowserWindow.ClearCache(); Image image = window.CaptureImage(); image.Save(@"c:\captured.jpeg", ImageFormat.Jpeg); image.Dispose(); //Releasing BrowserWindow.CurrentBrowser = "Firefox"; // or "Chrome" or "IE" window.Refresh(); window.Forward(); window.Back(); window.NavigateToHomepage(); }