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 ScreenShotLaboratoryscreenshots
-
Constructor Summary
Constructors Constructor Description Screenshots()
-
Method Summary
All Methods Static Methods Concrete 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 currentcontextthreadstatic java.io.FilegetLastScreenshot()Get the last screenshot takenstatic java.util.Optional<java.io.File>getLastThreadScreenshot()Get the last screenshot taken in current threadstatic voidstartContext(java.lang.String className, java.lang.String methodName)static java.lang.StringtakeScreenShot(java.lang.String fileName)Take screenshot and give it filenamestatic java.lang.StringtakeScreenShot(java.lang.String className, java.lang.String methodName)static java.io.FiletakeScreenShot(org.openqa.selenium.WebElement element)Take screenshot of the WebElement/SelenideElementstatic java.io.FiletakeScreenShot(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.FiletakeScreenShotAsFile()Take screenshot and return as a filestatic java.awt.image.BufferedImagetakeScreenShotAsImage(org.openqa.selenium.WebElement element)Take screenshot of the WebElement/SelenideElementstatic java.awt.image.BufferedImagetakeScreenShotAsImage(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
-
takeScreenShot
@CheckReturnValue @Nullable public static java.lang.String takeScreenShot(java.lang.String className, java.lang.String methodName)
-
takeScreenShot
@CheckReturnValue @Nullable public static java.lang.String takeScreenShot(java.lang.String fileName)
Take screenshot and give it filename- Returns:
- absolute path of the screenshot taken or null if failed to create screenshot
-
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:
Optionalwith 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 currentcontextthread- Returns:
Optionalwith screenshot of currentcontextthread, or an empty Optional if there were no any screenshots taken.
-
-