Package org.fluentlenium.utils
Class ImageUtils
- java.lang.Object
-
- org.fluentlenium.utils.ImageUtils
-
public class ImageUtils extends java.lang.Object
Provides logic for screenshot and image manipulation and conversion.
-
-
Constructor Summary
Constructors Constructor Description ImageUtils(org.openqa.selenium.WebDriver driver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.openqa.selenium.WebDriver
getDriver()
byte[]
handleAlertAndTakeScreenshot()
Accepts the current alert window and takes a screenshot.static java.awt.image.BufferedImage
toBufferedImage(java.lang.String fileName)
Converts the file referenced by the argument file name to aBufferedImage
.
-
-
-
Method Detail
-
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 java.awt.image.BufferedImage toBufferedImage(java.lang.String fileName) throws java.io.IOException
Converts the file referenced by the argument file name to aBufferedImage
.- Parameters:
fileName
- the name of the file to convert- Returns:
- the converted BufferedImage
- Throws:
java.nio.file.NoSuchFileException
- if the argument file cannot be foundScreenshotNotCreatedException
- if a problem occurred during image conversionjava.io.IOException
-
-