Package com.codeborne.selenide
Class Screenshots
- java.lang.Object
-
- com.codeborne.selenide.Screenshots
-
@ParametersAreNonnullByDefault public class Screenshots extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static ScreenShotLaboratory
screenshots
-
Constructor Summary
Constructors Constructor Description Screenshots()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.util.List<java.io.File>
finishContext()
static java.util.Optional<java.io.File>
getLastContextScreenshot()
Get the last screenshot taken in currentcontext
threadstatic java.io.File
getLastScreenshot()
Get the last screenshot takenstatic java.util.Optional<java.io.File>
getLastThreadScreenshot()
Get the last screenshot taken in current threadstatic java.lang.String
saveScreenshotAndPageSource()
static void
startContext(java.lang.String className, java.lang.String methodName)
static java.lang.String
takeScreenShot(java.lang.String fileName)
Deprecated.static Screenshot
takeScreenShot(java.lang.String className, java.lang.String methodName)
static java.io.File
takeScreenShot(org.openqa.selenium.WebElement element)
Take screenshot of the WebElement/SelenideElementstatic java.io.File
takeScreenShot(org.openqa.selenium.WebElement iframe, org.openqa.selenium.WebElement element)
Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be presentstatic java.io.File
takeScreenShotAsFile()
Take screenshot and return as a filestatic java.awt.image.BufferedImage
takeScreenShotAsImage(org.openqa.selenium.WebElement element)
Take screenshot of the WebElement/SelenideElementstatic java.awt.image.BufferedImage
takeScreenShotAsImage(org.openqa.selenium.WebElement iframe, org.openqa.selenium.WebElement element)
Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be present
-
-
-
Field Detail
-
screenshots
public static ScreenShotLaboratory screenshots
-
-
Method Detail
-
saveScreenshotAndPageSource
@CheckReturnValue public static java.lang.String saveScreenshotAndPageSource()
-
takeScreenShot
@CheckReturnValue @Nonnull public static Screenshot takeScreenShot(java.lang.String className, java.lang.String methodName)
-
takeScreenShot
@CheckReturnValue @Nullable @Deprecated public static java.lang.String takeScreenShot(java.lang.String fileName)
Deprecated.
-
takeScreenShotAsFile
@CheckReturnValue @Nullable public static java.io.File takeScreenShotAsFile()
Take screenshot and return as a file- Returns:
- a temporary file, not guaranteed to be stored after tests complete.
-
takeScreenShot
@CheckReturnValue @Nullable public static java.io.File takeScreenShot(org.openqa.selenium.WebElement element)
Take screenshot of the WebElement/SelenideElement- Returns:
- a temporary file, not guaranteed to be stored after tests complete.
-
takeScreenShot
@CheckReturnValue @Nullable public static java.io.File takeScreenShot(org.openqa.selenium.WebElement iframe, org.openqa.selenium.WebElement element)
Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be present- Returns:
- a temporary file, not guaranteed to be stored after tests complete.
-
takeScreenShotAsImage
@CheckReturnValue @Nullable public static java.awt.image.BufferedImage takeScreenShotAsImage(org.openqa.selenium.WebElement iframe, org.openqa.selenium.WebElement element)
Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be present- Returns:
- buffered image
-
takeScreenShotAsImage
@CheckReturnValue @Nullable public static java.awt.image.BufferedImage takeScreenShotAsImage(org.openqa.selenium.WebElement element)
Take screenshot of the WebElement/SelenideElement- Returns:
- buffered image
-
startContext
public static void startContext(java.lang.String className, java.lang.String methodName)
-
finishContext
@Nonnull public static java.util.List<java.io.File> finishContext()
-
getLastScreenshot
@CheckReturnValue @Nullable public static java.io.File getLastScreenshot()
Get the last screenshot taken- Returns:
- null if there were no any screenshots taken
-
getLastThreadScreenshot
@CheckReturnValue @Nonnull public static java.util.Optional<java.io.File> getLastThreadScreenshot()
Get the last screenshot taken in current thread- Returns:
Optional
with screenshot of current thread, or an empty Optional if there were no any screenshots taken.
-
getLastContextScreenshot
@CheckReturnValue @Nonnull public static java.util.Optional<java.io.File> getLastContextScreenshot()
Get the last screenshot taken in currentcontext
thread- Returns:
Optional
with screenshot of currentcontext
thread, or an empty Optional if there were no any screenshots taken.
-
-