Class ScreenShotLaboratory

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

public class ScreenShotLaboratory extends Object
  • Field Details

  • Method Details

    • getInstance

      public static ScreenShotLaboratory getInstance()
    • takeScreenShot

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

      protected String getScreenshotFileName(String className, String methodName)
    • takeScreenshot

      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

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

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

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

      protected String generateScreenshotFileName()
    • takeScreenshot

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

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

      public @Nullable File takeScreenShotAsFile(Driver driver)
    • addToHistory

      protected void addToHistory(Screenshot screenshot)
    • savePageImageToFile

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

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

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

      public void startContext(String context)
    • finishContext

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

      public List<File> getScreenshots()
    • getThreadScreenshots

      public List<@Nullable File> getThreadScreenshots()
    • threadScreenshots

      public List<Screenshot> threadScreenshots()
    • getContextScreenshots

      public List<@Nullable File> getContextScreenshots()
    • contextScreenshots

      public List<Screenshot> contextScreenshots()
    • getLastScreenshot

      public @Nullable File getLastScreenshot()
    • lastScreenshot

      public @Nullable Screenshot lastScreenshot()
    • getLastThreadScreenshot

      public Optional<File> getLastThreadScreenshot()
    • lastThreadScreenshot

      public Optional<Screenshot> lastThreadScreenshot()
    • getLastContextScreenshot

      public Optional<File> getLastContextScreenshot()
    • lastContextScreenshot

      public Optional<Screenshot> lastContextScreenshot()
    • takeScreenshot

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