Class Screenshots

java.lang.Object
com.codeborne.selenide.Screenshots

@ParametersAreNonnullByDefault public class Screenshots extends Object
  • Field Details

  • Constructor Details

    • Screenshots

      public Screenshots()
  • Method Details

    • saveScreenshotAndPageSource

      @CheckReturnValue public static String saveScreenshotAndPageSource()
    • takeScreenShot

      @CheckReturnValue @Nonnull public static Screenshot takeScreenShot(String className, String methodName)
    • takeScreenShotAsFile

      @CheckReturnValue @Nullable public static 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 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

      public static void startContext(String className, String methodName)
    • finishContext

      @Nonnull public static List<Screenshot> finishContext()
    • getLastScreenshot

      @CheckReturnValue @Nullable public static File getLastScreenshot()
      Get the last screenshot taken
      Returns:
      null if there were no any screenshots taken
    • getLastThreadScreenshot

      @CheckReturnValue @Nonnull public static Optional<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 Optional<File> getLastContextScreenshot()
      Get the last screenshot taken in current context thread
      Returns:
      Optional with screenshot of current context thread, or an empty Optional if there were no any screenshots taken.