Package com.codeborne.selenide.impl
Class ScreenShotLaboratory
java.lang.Object
com.codeborne.selenide.impl.ScreenShotLaboratory
-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<Screenshot>
protected final ThreadLocal<String>
protected final ThreadLocal<List<Screenshot>>
protected AtomicLong
protected final ThreadLocal<List<Screenshot>>
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToHistory
(Screenshot screenshot) protected String
static ScreenShotLaboratory
protected String
getScreenshotFileName
(String className, String methodName) protected File
savePageImageToFile
(Config config, String fileName, Driver driver) protected File
savePageSourceToFile
(Config config, String fileName, Driver driver) void
startContext
(String context) void
startContext
(String className, String methodName) takeScreenshot
(Driver driver, boolean saveScreenshot, boolean savePageSource) takeScreenshot
(Driver driver, String fileName, boolean saveScreenshot, boolean savePageSource) Takes screenshot of current browser window.takeScreenshot
(Driver driver, org.openqa.selenium.WebElement element) takeScreenshot
(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element) takeScreenShot
(Driver driver, String className, String methodName) <T> T
takeScreenShot
(Driver driver, org.openqa.selenium.OutputType<T> outputType) takeScreenShotAsFile
(Driver driver) takeScreenshotAsImage
(Driver driver, org.openqa.selenium.WebElement element) takeScreenshotAsImage
(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element)
-
Field Details
-
allScreenshots
-
screenshotCounter
-
currentContext
-
currentContextScreenshots
-
threadScreenshots
-
-
Method Details
-
getInstance
-
takeScreenShot
@CheckReturnValue @Nonnull public Screenshot takeScreenShot(Driver driver, String className, String methodName) -
getScreenshotFileName
-
takeScreenshot
@CheckReturnValue @Nonnull public Screenshot takeScreenshot(Driver driver, String fileName, boolean saveScreenshot, boolean savePageSource) Takes screenshot of current browser window. Stores 2 files: 1. html of the page (if "savePageSource" parameter is true), and 2. screenshot of the page in PNG format (if "saveScreenshot" parameter is true)Either file may be null if webdriver has failed to save it.
- Parameters:
fileName
- name of file (without extension) to store screenshot to.- Returns:
- instance of
Screenshot
containing both files
-
takeScreenShot
@CheckReturnValue @Nullable public <T> T takeScreenShot(Driver driver, org.openqa.selenium.OutputType<T> outputType) -
takeScreenshot
-
takeScreenshotAsImage
@CheckReturnValue @Nullable public BufferedImage takeScreenshotAsImage(Driver driver, org.openqa.selenium.WebElement element) -
generateScreenshotFileName
-
takeScreenshot
@CheckReturnValue @Nullable public File takeScreenshot(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element) -
takeScreenshotAsImage
@CheckReturnValue @Nullable public BufferedImage takeScreenshotAsImage(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element) -
takeScreenShotAsFile
-
addToHistory
-
savePageImageToFile
-
savePageSourceToFile
-
startContext
-
startContext
-
finishContext
-
getScreenshots
-
getThreadScreenshots
-
threadScreenshots
-
getContextScreenshots
-
contextScreenshots
-
getLastScreenshot
-
lastScreenshot
-
getLastThreadScreenshot
-
lastThreadScreenshot
-
getLastContextScreenshot
-
lastContextScreenshot
-
takeScreenshot
@CheckReturnValue @Nonnull public Screenshot takeScreenshot(Driver driver, boolean saveScreenshot, boolean savePageSource)
-