public Bitmap PobierzBMP() { DebugLog("Pobieram zdjecie dokumentu"); var sekcja = GetTabpageByName(tabpage); Element pdf = sekcja.FindSingle(".//container[@automationid='documentPreviewScrollViewer']"); return(Imaging.CaptureImage(pdf)); }
public static void VisualCheckpoint(Adapter adapter, string stepDescription) { if (adapter == null) { throw new ArgumentNullException("adapter"); } EyesWrapper.StartOrContinueTest(GetTestCaseName()); Report.Info(string.Format("Applitools 'CheckImage' called with screenshot from repository item '{0}'.", adapter)); try { ProgressForm.SetOpacity(0); Bitmap image; if (adapter.Element.HasCapability("webdocument")) { var webDocument = adapter.As <WebDocument>(); EyesWrapper.SetBrowserName(webDocument.BrowserName); if (EyesWrapper.ViewPortWidth > 0 && EyesWrapper.ViewPortHeight > 0) { webDocument.Browser.Resize(EyesWrapper.ViewPortWidth, EyesWrapper.ViewPortHeight); } webDocument.WaitForDocumentLoaded(); image = webDocument.CaptureFullPageScreenshot(screenshotCaptureFlag); } else { var browserName = string.Empty; if (adapter.Element.HasCapability("webelement")) { var parent = adapter.Parent; while (parent.As <WebDocument>() == null) { parent = parent.Parent; } browserName = parent.As <WebDocument>().BrowserName; } EyesWrapper.SetBrowserName(browserName); image = Imaging.CaptureImage(adapter.Element); } EyesWrapper.CheckImage(image, stepDescription); } finally { ProgressForm.SetOpacity(100); } }