I use Java + Selenium Webdriver. There is a task:
- Make 4 screenshots (with an interval of 5 seconds).
- For each screenshot, get and save md5-hash.
- Compare the obtained hash values (all should be different).
Help me figure out what and how?
To take a screenshot, you can call the getScreenshotAs(OutputType target)
method:
File screenShot = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE); BufferedImage screenshotImage = ImageIO.read(screenShot);
- In the first line we make a screenshot.
- Convert it to
BufferedImage
- Why is it necessary or not necessary? - How can I save a screenshot on a computer?