While taking Screenshot using WebDriver , is it possible to take along with Page URL?

Is it possible to include Web Page Address bar while taking FullPage Screenshot using Selenium WebDriver?

1 Like

In selenium capturing the Web Page Address bar is not possible. We have to use any third-party framework like Robot to capture full page screenshot

Here is the code snippet using the ROBOT framework.

 String FileLocation= System.getProperty("user.dir") + File.separator + "screenshots";
 Robot robot = new Robot();
 Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
 BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
 ImageIO.write(screenShot, "JPG",new File(FileLocation+File.separator +"ScreenShotByRobot.jpg"));
1 Like