Package com.codeborne.selenide
Class Screenshots
java.lang.Object
com.codeborne.selenide.Screenshots
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic com.codeborne.selenide.impl.ScreenShotLaboratory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the last screenshot taken in currentcontextthreadstatic FileGet the last screenshot takenGet the last screenshot taken in current threadstatic Stringstatic voidstartContext(String className, String methodName) static com.codeborne.selenide.impl.ScreenshottakeScreenShot(String className, String methodName) static FiletakeScreenShot(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElementstatic FiletakeScreenShot(org.openqa.selenium.WebElement iframe, com.codeborne.selenide.SelenideElement element) Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be presentstatic FileTake screenshot and return as a filestatic BufferedImagetakeScreenShotAsImage(org.openqa.selenium.WebElement element) Take screenshot of the WebElement/SelenideElementstatic BufferedImagetakeScreenShotAsImage(org.openqa.selenium.WebElement iframe, com.codeborne.selenide.SelenideElement element) Take screenshot of WebElement/SelenideElement in iframe for partially visible WebElement/Selenide horizontal scroll bar will be present
-
Field Details
-
screenshots
public static com.codeborne.selenide.impl.ScreenShotLaboratory screenshots
-
-
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
@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, com.codeborne.selenide.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, com.codeborne.selenide.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:
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.
-