Making .NET screenshot test resize window to remove scrollbar before screenshot
@@ -301,7 +301,6 @@ public void ShouldCaptureScreenshotAtFramePage()
}
[Test]
- [IgnoreBrowser(Browser.IE, "Color comparisons fail on IE")]
public void ShouldCaptureScreenshotAtIFramePage()
{
ITakesScreenshot screenshotCapableDriver = driver as ITakesScreenshot;
@@ -312,7 +311,12 @@ public void ShouldCaptureScreenshotAtIFramePage()
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("screen/screen_iframes.html");
+ // Resize the window to avoid scrollbars in screenshot
+ Size originalSize = driver.Manage().Window.Size;
+ driver.Manage().Window.Size = new Size(1040, 700);
+
Screenshot screenshot = screenshotCapableDriver.GetScreenshot();
+ driver.Manage().Window.Size = originalSize;
HashSet<string> actualColors = ScanActualColors(screenshot,
/* stepX in pixels */ 5,
@@ -366,7 +370,6 @@ public void ShouldCaptureScreenshotAtFramePageAfterSwitching()
}
[Test]
- [IgnoreBrowser(Browser.IE, "Color comparisons fail on IE")]
[IgnoreBrowser(Browser.Firefox, "Color comparisons fail on Firefox")]
public void ShouldCaptureScreenshotAtIFramePageAfterSwitching()
{
@@ -378,9 +381,14 @@ public void ShouldCaptureScreenshotAtIFramePageAfterSwitching()
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("screen/screen_iframes.html");
+ // Resize the window to avoid scrollbars in screenshot
+ Size originalSize = driver.Manage().Window.Size;
+ driver.Manage().Window.Size = new Size(1040, 700);
+
driver.SwitchTo().Frame(driver.FindElement(By.Id("iframe2")));
Screenshot screenshot = screenshotCapableDriver.GetScreenshot();
+ driver.Manage().Window.Size = originalSize;
HashSet<string> actualColors = ScanActualColors(screenshot,
/* stepX in pixels */ 5,
