Class ImageUtils

java.lang.Object
io.fluentlenium.utils.ImageUtils

public class ImageUtils extends Object
Provides logic for screenshot and image manipulation and conversion.
  • Constructor Details

    • ImageUtils

      public ImageUtils (org.openqa.selenium.WebDriver driver)
  • Method Details

    • getDriver

      public org.openqa.selenium.WebDriver getDriver()
    • handleAlertAndTakeScreenshot

      public byte[] handleAlertAndTakeScreenshot()
      Accepts the current alert window and takes a screenshot.

      The FluentLenium logo is also added on to the screenshot.

      Returns:
      the screenshot as a byte array
      Throws:
      ScreenshotNotCreatedException - if a problem occurred during reading the screenshot file
    • toBufferedImage

      public static BufferedImage toBufferedImage (String fileName) throws IOException
      Converts the file referenced by the argument file name to a BufferedImage.
      Parameters:
      fileName - the name of the file to convert
      Returns:
      the converted BufferedImage
      Throws:
      NoSuchFileException - if the argument file cannot be found
      ScreenshotNotCreatedException - if a problem occurred during image conversion
      IOException