Package com.codeborne.selenide
Class Screenshots
java.lang.Object
com.codeborne.selenide.Screenshots
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<Screenshot>
Get the last screenshot taken in currentcontext
threadstatic File
Get the last screenshot takenGet the last screenshot taken in current threadstatic String
static void
startContext
(String className, String methodName) static Screenshot
takeScreenShot
(String className, String methodName) static File
takeScreenShot
(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElementstatic File
takeScreenShot
(org.openqa.selenium.WebElement iframe, SelenideElement element) Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be presentstatic File
Take screenshot and return as a filestatic BufferedImage
takeScreenShotAsImage
(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElementstatic BufferedImage
takeScreenShotAsImage
(org.openqa.selenium.WebElement iframe, SelenideElement element) Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be present
-
Field Details
-
screenshots
-
-
Constructor Details
-
Screenshots
public Screenshots()
-
-
Method Details
-
saveScreenshotAndPageSource
-
takeScreenShot
@CheckReturnValue @Nonnull public static Screenshot takeScreenShot(String className, String methodName) -
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 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 File takeScreenShot(org.openqa.selenium.WebElement iframe, SelenideElement 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 BufferedImage takeScreenShotAsImage(org.openqa.selenium.WebElement iframe, SelenideElement 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 BufferedImage takeScreenShotAsImage(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElement- Returns:
- buffered image
-
startContext
-
finishContext
-
getLastScreenshot
Get the last screenshot taken- Returns:
- null if there were no any screenshots taken
-
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
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.
-