How can i take screenshot of whole desktop+entire DOM? | Selenium Forum
M
Posted on 30/09/2016
Sir,

i Need to take screenshot of whole DOM[invisible+visible] +address bar from browser container...

[b:1ov6aqtd]Query: Sir, is this possible sir???[/b:1ov6aqtd]

[u:1ov6aqtd]
I have few references:[/u:1ov6aqtd]

http://seleniumhq.github.io/selenium/docs/api/java/index.html
http://krezydibs.blogspot.in/2012/07/taking-screenshot-using.html

In 2nd reference link , i have my current code like 1st method discussed.
They also discuss 2nd method, but its using Robot class ..[not selenium library]

Am not finding more details or a method in selenium java docs which can generate "The screenshot of the entire display containing the browser" [DOM[invisible+visible] +address bar]

[b:1ov6aqtd]Please suggest sir...[/b:1ov6aqtd]

M
Replied on 01/10/2016

no it is not possible with selenium. you have to use some other way.


M
Replied on 02/10/2016

Hi Sir,

Have taken screenshot of my desktop using this code..
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.File;

...

public void captureScreen(String fileName) throws Exception {

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle screenRectangle = new Rectangle(screenSize);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(screenRectangle);
ImageIO.write(image, "png", new File(fileName));

}

[b:zff89b2p]Query:Sir i could capture screenshot as in "PRINTSCREEN", but invisible DOM area is not captured.Is there a way out to capture entire invisible DOM in screenshot?
Please suggest sir...[/b:zff89b2p]

Responsive image

M
Replied on 03/10/2016

i don't know, chaitra. Google it if you find something post it here.