Kodiyan
Kodiyan

Reputation: 377

Fullpage Screenshot for IE and Chrome using Selenium JVM

I am trying to take full page (without any scroll bar) screenshots using Selenium in Java. My code below is working perfect in Firefox 29. I tested the same code in Chrome 35 and it is taking partial screenshot (not full page, screen with scroll bar) and IE8 is not supporting screen shots with Selenium Drive.

File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("C://screenshot//" + image1.jpg));

Upvotes: 1

Views: 3068

Answers (1)

Purus
Purus

Reputation: 5799

I don't see any issue on the screenshot in any browsers. For me it takes the full page view.

You can try to use the below approach of using augmenter() which is generally used for RemoteWebDriver execution.

WebDriver augmentedDriver = new Augmenter().augment(driver); 

File f = null; 

if (augmentedDriver instanceof TakesScreenshot) { 
   f = ((TakesScreenshot) augmentedDriver).getScreenshotAs(OutputType.FILE); 
} else { 
    // screenshot not taken
} 

Upvotes: 0

Related Questions