public final class ScreenshotUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isSimilarToScreenshot(org.openqa.selenium.WebDriver wd,
org.openqa.selenium.WebElement element,
java.io.File controlPicture,
java.io.File toSaveAs)
Prereq: The page on which you are taking the screenshot is fully loaded
Take a screenshot of the element identified by element and save the file
as toSaveAs (Note that this file should be saved as a png).
|
static boolean |
isSimilarToScreenshot(org.openqa.selenium.WebDriver wd,
org.openqa.selenium.WebElement element,
java.io.File controlPicture,
java.io.File toSaveAs,
double threshold)
Prereq: The page on which you are taking the screenshot is fully loaded
Take a screenshot of the element identified by element and save the file
as toSaveAs (Note that this file should be saved as a png).
|
static void |
saveScreenshot(java.lang.String screenshotFileName,
org.openqa.selenium.WebDriver driver)
Save a screenshot.
|
static void |
takeScreenshotOfElement(org.openqa.selenium.WebElement element,
java.io.File toSaveAs,
org.openqa.selenium.WebDriver wd)
You can use this method to take your control pictures.
|
public static void saveScreenshot(java.lang.String screenshotFileName,
org.openqa.selenium.WebDriver driver)
screenshotFileName - name of the file, without ending.driver - the webdriver.public static void takeScreenshotOfElement(org.openqa.selenium.WebElement element,
java.io.File toSaveAs,
org.openqa.selenium.WebDriver wd)
throws java.io.IOException
element - the webelementtoSaveAs - the file where the screenshot should be save.wd - the webdriver.java.io.IOException - if something goes wrong writing the result.public static boolean isSimilarToScreenshot(org.openqa.selenium.WebDriver wd,
org.openqa.selenium.WebElement element,
java.io.File controlPicture,
java.io.File toSaveAs,
double threshold)
throws java.io.IOException
wd - the webdriver.element - - the element to be testedcontrolPicture - - the file of the picture that will serve as the
controltoSaveAs - - for example, save the file at
"testData/textFieldWidget/screenshot.png"threshold - - you are asserting that the similarity between the two
pictures is a double greater than or equal to this double
(between 0.0 and 1.0)java.io.IOException - if something goes wrong writing or reading.public static boolean isSimilarToScreenshot(org.openqa.selenium.WebDriver wd,
org.openqa.selenium.WebElement element,
java.io.File controlPicture,
java.io.File toSaveAs)
throws java.io.IOException
wd - the webdriver.element - - the element to be testedcontrolPicture - - the file of the picture that will serve as the
controltoSaveAs - - for example, save the file at
"testData/textFieldWidget/screenshot.png"java.io.IOException - if something goes wrong reading or writing.Copyright © 2017 PPI AG. All rights reserved.