public abstract class Snapshot<T extends Snapshot>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected org.openqa.selenium.WebDriver |
driver |
protected static java.lang.String |
ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE |
protected java.awt.image.BufferedImage |
image |
protected java.awt.image.BufferedImage |
thumbnailImage |
| Constructor and Description |
|---|
Snapshot() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.awt.image.BufferedImage image) |
boolean |
equals(java.awt.image.BufferedImage image,
double deviation) |
boolean |
equals(java.lang.Object o) |
boolean |
equals(Snapshot other,
double deviation) |
boolean |
equalsWithDiff(java.awt.image.BufferedImage image,
java.lang.String resultingImagePath) |
boolean |
equalsWithDiff(java.awt.image.BufferedImage image,
java.lang.String resultingImagePath,
double deviation) |
boolean |
equalsWithDiff(Snapshot image,
java.lang.String resultingImagePath) |
boolean |
equalsWithDiff(Snapshot image,
java.lang.String resultingImagePath,
double deviation) |
java.awt.image.BufferedImage |
getImage() |
int |
hashCode() |
T |
monochrome()
Apply gray-and-white filter to the image.
|
void |
save()
Final method to be called in the chain.
|
void |
save(java.lang.String path)
Final method to be called in the chain.
|
protected abstract T |
self() |
protected void |
setImage(java.awt.image.BufferedImage image) |
T |
withName(java.lang.String name) |
T |
withThumbnail(double scale)
Generate a thumbnail of the original screenshot.
|
T |
withThumbnail(java.nio.file.Path path,
java.lang.String name,
double scale)
Generate a thumbnail of the original screenshot.
|
T |
withThumbnail(java.lang.String path,
java.lang.String name,
double scale)
Generate a thumbnail of the original screenshot.
|
T |
withTitle(java.lang.String title) |
protected static final java.lang.String ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE
protected java.awt.image.BufferedImage image
protected java.awt.image.BufferedImage thumbnailImage
protected org.openqa.selenium.WebDriver driver
protected abstract T self()
public T withName(java.lang.String name)
name - file name of the resulted image
by default will be timestamp in format: 'yyyy_MM_dd_HH_mm_ss_SSS'.public T withTitle(java.lang.String title)
title - title of the resulted image.
Won't be assigned by default.public T withThumbnail(java.lang.String path, java.lang.String name, double scale)
path - to save thumbnail image toname - of the resulting imagescale - to applypublic T withThumbnail(java.nio.file.Path path, java.lang.String name, double scale)
path - to save thumbnail image toname - of the resulting imagescale - to applypublic T withThumbnail(double scale)
scale - to applypublic T monochrome()
public java.awt.image.BufferedImage getImage()
protected void setImage(java.awt.image.BufferedImage image)
public void save()
public void save(java.lang.String path)
path - to save image topublic boolean equals(Snapshot other, double deviation)
other - Snapshot to compare withdeviation - allowed deviation while comparing.public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - Object to compare withpublic boolean equals(java.awt.image.BufferedImage image)
image - BufferedImage to compare with.public boolean equals(java.awt.image.BufferedImage image,
double deviation)
image - BufferedImage to compare with.deviation - allowed deviation while comparing.public boolean equalsWithDiff(java.awt.image.BufferedImage image,
java.lang.String resultingImagePath)
image - BufferedImage to compare with.resultingImagePath - path with name to save to resulting images with diffpublic boolean equalsWithDiff(java.awt.image.BufferedImage image,
java.lang.String resultingImagePath,
double deviation)
image - BufferedImage to compare with.resultingImagePath - path with name to save to resulting images with diffdeviation - allowed deviation while comparingpublic boolean equalsWithDiff(Snapshot image, java.lang.String resultingImagePath)
image - Snapshot to compare with.resultingImagePath - path with name to save to resulting images with diffpublic boolean equalsWithDiff(Snapshot image, java.lang.String resultingImagePath, double deviation)
image - Snapshot to compare with.resultingImagePath - path with name to save to resulting images with diffdeviation - allowed deviation while comparingpublic int hashCode()
hashCode in class java.lang.Object