Webdriver - IE Flickering while taking the screenshot
internet-explorer, java, selenium, selenium-webdriver, webdriver
Solution
I'm surprised you did not find any references to this on the web. There is at least one blog post that makes passing mention of it, and there's always the source code that would tell you exactly what it is doing.
The "flickering" you describe is probably due to the way the IE driver manipulates the IE window to take a screenshot. In the WebDriver API, a screenshot should be taken of the full DOM of a page. The IE driver uses the Windows PrintWindow API to take the screenshot. However, the only way to take a screenshot of the entire DOM is to resize the IE browser window to display the entire DOM before taking the screenshot. The driver then restores the previous size of the window. This window resize is what appears to cause "flickering". Since the Firefox and Chrome drivers use fundamentally different ways to generate their screenshots (methods unavailable to the IE driver due to the latter's architecture), they do not exhibit this behavior.
Problem
I have a problem of Flickering while taking the screenshot in IE, i have searched all over the internet and found no solution for this issue. I have found this alternate solution for taking the screenshots for the test steps. I have not used the webdriver API to take the screenshot but instead relied on Java Robot API to take the screenshot. I have used the following code for taking the screenshots in IE without any flickering. ``` public static boolean TakeScreenshot(String filePath){ boolean b = false; try { BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); b = ImageIO.write(image, "png", new File(filePath)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return b; ``` } is there any solution to the webdriver API for this flickering issue in Internet Explorer?