Package com.codeborne.selenide
Class Screenshots
java.lang.Object
com.codeborne.selenide.Screenshots
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<Screenshot>Get the last screenshot taken in currentcontextthreadstatic @Nullable FileGet the last screenshot takenGet the last screenshot taken in current threadstatic Stringstatic voidstartContext(String className, String methodName) static ScreenshottakeScreenShot(String className, String methodName) static FiletakeScreenShot(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElementstatic @Nullable FiletakeScreenShot(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 @Nullable FileTake screenshot and return as a filestatic BufferedImagetakeScreenShotAsImage(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElementstatic @Nullable BufferedImagetakeScreenShotAsImage(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
-
Constructor Details
-
Screenshots
public Screenshots()
-
-
Method Details
-
saveScreenshotAndPageSource
-
takeScreenShot
-
takeScreenShotAsFile
Take screenshot and return as a file- Returns:
- a temporary file, not guaranteed to be stored after tests complete.
-
takeScreenShot
Take screenshot of the WebElement/SelenideElement- Returns:
- a temporary file, not guaranteed to be stored after tests complete.
-
takeScreenShot
public static @Nullable 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
public static @Nullable 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
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:
Optionalwith screenshot of current thread, or an empty Optional if there were no any screenshots taken.
-
getLastContextScreenshot
Get the last screenshot taken in currentcontextthread- Returns:
Optionalwith screenshot of currentcontextthread, or an empty Optional if there were no any screenshots taken.
-