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<@Nullable List<Screenshot>>
protected AtomicLong
protected final ThreadLocal<List<Screenshot>>
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToHistory
(Screenshot screenshot) protected String
static ScreenShotLaboratory
@Nullable File
protected String
getScreenshotFileName
(String className, String methodName) @Nullable Screenshot
protected @Nullable 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) @Nullable File
takeScreenshot
(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element) takeScreenShot
(Driver driver, String className, String methodName) <T> @Nullable T
takeScreenShot
(Driver driver, org.openqa.selenium.OutputType<T> outputType) @Nullable File
takeScreenShotAsFile
(Driver driver) takeScreenshotAsImage
(Driver driver, org.openqa.selenium.WebElement element) @Nullable BufferedImage
takeScreenshotAsImage
(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element)
-
Field Details
-
allScreenshots
-
screenshotCounter
-
currentContext
-
currentContextScreenshots
-
threadScreenshots
-
-
Method Details
-
getInstance
-
takeScreenShot
-
getScreenshotFileName
-
takeScreenshot
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
-
takeScreenshot
-
takeScreenshotAsImage
-
generateScreenshotFileName
-
takeScreenshot
public @Nullable File takeScreenshot(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element) -
takeScreenshotAsImage
public @Nullable 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
@CanIgnoreReturnValue public Screenshot takeScreenshot(Driver driver, boolean saveScreenshot, boolean savePageSource)
-