This repository was archived by the owner on Nov 29, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 195
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
Unable to take screenshot of child window in IE #7256
Copy link
Copy link
Closed
Description
Originally reported on Google Code with ID 7256
A simple scenario which works well in Firefox and Chrome. The problem occurs on IE,
versions 9 and 11 (I haven't tried any other versions)
What steps will reproduce the problem?
1. Open the webpage ("http://www.ipo.gov.uk/types/hargreaves.htm")
2. Click on a hyperlink which opens a PDF in a separate browser window. I can maximise
that window in FF, Chrome and IE (proving that all 3 browsers can interact with it?).
A subsequent attempt to take a screenshot of that (child) browser window FAILS in IE.
3. I CAN take screenshots of the PARENT browser windows in FF, Chrome and IE.
Selenium version: 2.39.0
OS: Win 7
Browser: IE 9, 11
C# SNIPPET:
//Navigate to webpage
Driver.Navigate().GoToUrl("http://www.ipo.gov.uk/types/hargreaves.htm");
//Click hyperlink which opens a child IE window containing a pdf
IWebElement linkSurvey = DriverFindElement(By.PartialLinkText("simple guide"));
linkSurvey.Click();
//Switch focus to "new" child window...
string parentWindow = Driver.CurrentWindowHandle;
//hCount = 2 if you run this code
//int hCount= Driver.WindowHandles.Count();
foreach (var handle in Driver.WindowHandles)
{
if (!handle.Equals(parentWindow))
{
Driver.SwitchTo().Window(handle);
//This maximise has its desired effect in all browsers...==>
Driver.Manage().Window.Maximize();
//Prepare to take screenshot
var expImageLocation = new StringBuilder(Globals.Env.EXPECTED_FILEPATH);
ITakesScreenshot screenshotDriver = Driver.Instance as ITakesScreenshot;
//After the next line is executed, the "screenshot" object is empty
in IE - and I get the error "Parameter is not valid" if I subsequently save this to
a file...=>>>
Screenshot screenshot = screenshotDriver.GetScreenshot();
}
}
Reported by ope1973
on 2014-04-25 13:30:23