Class ScreenShotLaboratory

java.lang.Object
com.codeborne.selenide.impl.ScreenShotLaboratory

@ParametersAreNonnullByDefault public class ScreenShotLaboratory extends Object
  • Field Details

  • Constructor Details

    • ScreenShotLaboratory

      protected ScreenShotLaboratory()
    • ScreenShotLaboratory

      protected ScreenShotLaboratory(Photographer photographer, PageSourceExtractor extractor, com.codeborne.selenide.impl.Clock clock)
  • Method Details

    • getInstance

      public static ScreenShotLaboratory getInstance()
    • takeScreenShot

      @CheckReturnValue @Nonnull public Screenshot takeScreenShot(Driver driver, String className, String methodName)
    • getScreenshotFileName

      @CheckReturnValue @Nonnull protected String getScreenshotFileName(String className, String methodName)
    • takeScreenshot

      @CheckReturnValue @Nonnull public Screenshot takeScreenshot(Driver driver, String fileName, boolean saveScreenshot, boolean savePageSource)
      Takes screenshot of current browser window. Stores 2 files: 1. html of the page (if "savePageSource" parameter is true), and 2. screenshot of the page in PNG format (if "saveScreenshot" parameter is true)

      Either file may be null if webdriver has failed to save it.

      Parameters:
      fileName - name of file (without extension) to store screenshot to.
      Returns:
      instance of Screenshot containing both files
    • takeScreenShot

      @CheckReturnValue @Nullable public <T> T takeScreenShot(Driver driver, org.openqa.selenium.OutputType<T> outputType)
    • takeScreenshot

      @CheckReturnValue @Nullable public File takeScreenshot(Driver driver, org.openqa.selenium.WebElement element)
    • takeScreenshotAsImage

      @CheckReturnValue @Nullable public BufferedImage takeScreenshotAsImage(Driver driver, org.openqa.selenium.WebElement element)
    • generateScreenshotFileName

      @CheckReturnValue @Nonnull protected String generateScreenshotFileName()
    • takeScreenshot

      @CheckReturnValue @Nullable public File takeScreenshot(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element)
    • takeScreenshotAsImage

      @CheckReturnValue @Nullable public BufferedImage takeScreenshotAsImage(Driver driver, org.openqa.selenium.WebElement iframe, SelenideElement element)
    • takeScreenShotAsFile

      @CheckReturnValue @Nullable public File takeScreenShotAsFile(Driver driver)
    • addToHistory

      protected void addToHistory(Screenshot screenshot)
    • savePageImageToFile

      @CheckReturnValue @Nullable protected File savePageImageToFile(Config config, String fileName, Driver driver)
    • savePageSourceToFile

      @CheckReturnValue @Nonnull protected File savePageSourceToFile(Config config, String fileName, Driver driver)
    • startContext

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

      public void startContext(String context)
    • finishContext

      @Nonnull public List<Screenshot> finishContext()
    • getScreenshots

      @CheckReturnValue @Nonnull public List<File> getScreenshots()
    • getThreadScreenshots

      @CheckReturnValue @Nonnull public List<File> getThreadScreenshots()
    • threadScreenshots

      @CheckReturnValue @Nonnull public List<Screenshot> threadScreenshots()
    • getContextScreenshots

      @CheckReturnValue @Nonnull public List<File> getContextScreenshots()
    • contextScreenshots

      @CheckReturnValue @Nonnull public List<Screenshot> contextScreenshots()
    • getLastScreenshot

      @CheckReturnValue @Nullable public File getLastScreenshot()
    • lastScreenshot

      @CheckReturnValue @Nullable public Screenshot lastScreenshot()
    • getLastThreadScreenshot

      @CheckReturnValue @Nonnull public Optional<File> getLastThreadScreenshot()
    • lastThreadScreenshot

      @CheckReturnValue @Nonnull public Optional<Screenshot> lastThreadScreenshot()
    • getLastContextScreenshot

      @CheckReturnValue @Nonnull public Optional<File> getLastContextScreenshot()
    • lastContextScreenshot

      @CheckReturnValue @Nonnull public Optional<Screenshot> lastContextScreenshot()
    • takeScreenshot

      @CheckReturnValue @Nonnull public Screenshot takeScreenshot(Driver driver, boolean saveScreenshot, boolean savePageSource)