public class ScreenshotUtils extends Object
| Constructor and Description |
|---|
ScreenshotUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isSimilarToScreenshot(IElement element,
File controlPicture,
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(IElement element,
File controlPicture,
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 |
takeScreenshotOfElement(IElement element,
File toSaveAs)
You can use this method to take your control pictures.
|
static void |
takeScreenshotOfPage(File toSaveAs)
Take a screenshot of the browser content.
|
public static void takeScreenshotOfElement(IElement element, File toSaveAs) throws IOException, WidgetException
element - toSaveAs - IOExceptionWidgetExceptionpublic static void takeScreenshotOfPage(File toSaveAs) throws IOException
toSaveAs - - name of the file to save the picture in (Note: must be PNG)IOExceptionpublic static boolean isSimilarToScreenshot(IElement element, File controlPicture, File toSaveAs, double threshold) throws IOException, WidgetException
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)IOExceptionWidgetExceptionpublic static boolean isSimilarToScreenshot(IElement element, File controlPicture, File toSaveAs) throws IOException, WidgetException
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"IOExceptionWidgetExceptionCopyright © 2018. All rights reserved.