@ParametersAreNonnullByDefault
public class ScreenShotLaboratory
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.io.File> |
allScreenshots |
protected java.lang.ThreadLocal<java.lang.String> |
currentContext |
protected java.lang.ThreadLocal<java.util.List<java.io.File>> |
currentContextScreenshots |
protected java.util.concurrent.atomic.AtomicLong |
screenshotCounter |
protected java.lang.ThreadLocal<java.util.List<java.io.File>> |
threadScreenshots |
| Modifier | Constructor and Description |
|---|---|
protected |
ScreenShotLaboratory() |
| Modifier and Type | Method and Description |
|---|---|
protected java.io.File |
addToHistory(java.io.File screenshot) |
java.util.List<java.io.File> |
finishContext() |
java.lang.String |
formatScreenShotPath(Driver driver) |
protected java.lang.String |
generateScreenshotFileName() |
java.util.List<java.io.File> |
getContextScreenshots() |
static ScreenShotLaboratory |
getInstance() |
java.util.Optional<java.io.File> |
getLastContextScreenshot() |
java.io.File |
getLastScreenshot() |
java.util.Optional<java.io.File> |
getLastThreadScreenshot() |
protected java.io.File |
getPageImage(org.openqa.selenium.WebDriver webdriver) |
protected java.lang.String |
getScreenshotFileName(java.lang.String className,
java.lang.String methodName) |
java.util.List<java.io.File> |
getScreenshots() |
java.util.List<java.io.File> |
getThreadScreenshots() |
protected java.io.File |
savePageImageToFile(Config config,
java.lang.String fileName,
org.openqa.selenium.WebDriver webdriver) |
protected java.io.File |
savePageSourceToFile(Config config,
java.lang.String fileName,
org.openqa.selenium.WebDriver webdriver) |
void |
startContext(java.lang.String context) |
void |
startContext(java.lang.String className,
java.lang.String methodName) |
java.lang.String |
takeScreenShot(Driver driver) |
<T> T |
takeScreenShot(Driver driver,
org.openqa.selenium.OutputType<T> outputType) |
java.lang.String |
takeScreenShot(Driver driver,
java.lang.String fileName)
Takes screenshot of current browser window.
|
java.lang.String |
takeScreenShot(Driver driver,
java.lang.String className,
java.lang.String methodName) |
java.io.File |
takeScreenshot(Driver driver,
org.openqa.selenium.WebElement element) |
java.io.File |
takeScreenshot(Driver driver,
org.openqa.selenium.WebElement iframe,
org.openqa.selenium.WebElement element) |
java.io.File |
takeScreenShotAsFile(Driver driver) |
java.awt.image.BufferedImage |
takeScreenshotAsImage(Driver driver,
org.openqa.selenium.WebElement element) |
java.awt.image.BufferedImage |
takeScreenshotAsImage(Driver driver,
org.openqa.selenium.WebElement iframe,
org.openqa.selenium.WebElement element) |
protected java.io.File |
takeScreenshotImage(Config config,
org.openqa.selenium.TakesScreenshot driver,
java.lang.String fileName) |
protected java.io.File |
takeScreenshotInMemory(org.openqa.selenium.TakesScreenshot driver) |
protected long |
timestamp() |
protected final java.util.List<java.io.File> allScreenshots
protected java.util.concurrent.atomic.AtomicLong screenshotCounter
protected java.lang.ThreadLocal<java.lang.String> currentContext
protected java.lang.ThreadLocal<java.util.List<java.io.File>> currentContextScreenshots
protected java.lang.ThreadLocal<java.util.List<java.io.File>> threadScreenshots
public static ScreenShotLaboratory getInstance()
@CheckReturnValue @Nullable public java.lang.String takeScreenShot(Driver driver, java.lang.String className, java.lang.String methodName)
@CheckReturnValue
@Nonnull
protected java.lang.String getScreenshotFileName(java.lang.String className,
java.lang.String methodName)
@CheckReturnValue @Nullable public java.lang.String takeScreenShot(Driver driver)
@CheckReturnValue @Nullable public java.lang.String takeScreenShot(Driver driver, java.lang.String fileName)
fileName - name of file (without extension) to store screenshot to.@CheckReturnValue @Nullable public <T> T takeScreenShot(Driver driver, org.openqa.selenium.OutputType<T> outputType)
@CheckReturnValue @Nullable public java.io.File takeScreenshot(Driver driver, org.openqa.selenium.WebElement element)
@CheckReturnValue @Nullable public java.awt.image.BufferedImage takeScreenshotAsImage(Driver driver, org.openqa.selenium.WebElement element)
@CheckReturnValue @Nonnull protected java.lang.String generateScreenshotFileName()
protected long timestamp()
@CheckReturnValue @Nullable public java.io.File takeScreenshot(Driver driver, org.openqa.selenium.WebElement iframe, org.openqa.selenium.WebElement element)
@CheckReturnValue @Nullable public java.awt.image.BufferedImage takeScreenshotAsImage(Driver driver, org.openqa.selenium.WebElement iframe, org.openqa.selenium.WebElement element)
@CheckReturnValue @Nullable public java.io.File takeScreenShotAsFile(Driver driver)
@CheckReturnValue @Nullable protected java.io.File getPageImage(org.openqa.selenium.WebDriver webdriver)
@Nonnull protected java.io.File addToHistory(java.io.File screenshot)
@CheckReturnValue @Nullable protected java.io.File takeScreenshotInMemory(org.openqa.selenium.TakesScreenshot driver)
@CheckReturnValue @Nullable protected java.io.File savePageImageToFile(Config config, java.lang.String fileName, org.openqa.selenium.WebDriver webdriver)
@CheckReturnValue @Nonnull protected java.io.File savePageSourceToFile(Config config, java.lang.String fileName, org.openqa.selenium.WebDriver webdriver)
@CheckReturnValue @Nullable protected java.io.File takeScreenshotImage(Config config, org.openqa.selenium.TakesScreenshot driver, java.lang.String fileName)
public void startContext(java.lang.String className,
java.lang.String methodName)
public void startContext(java.lang.String context)
@Nonnull public java.util.List<java.io.File> finishContext()
@CheckReturnValue @Nonnull public java.util.List<java.io.File> getScreenshots()
@CheckReturnValue @Nonnull public java.util.List<java.io.File> getThreadScreenshots()
@CheckReturnValue @Nonnull public java.util.List<java.io.File> getContextScreenshots()
@CheckReturnValue @Nullable public java.io.File getLastScreenshot()
@CheckReturnValue @Nonnull public java.util.Optional<java.io.File> getLastThreadScreenshot()
@CheckReturnValue @Nonnull public java.util.Optional<java.io.File> getLastContextScreenshot()
@CheckReturnValue @Nonnull public java.lang.String formatScreenShotPath(Driver driver)