Package io.fluentlenium.utils
Class ImageUtils
java.lang.Object
io.fluentlenium.utils.ImageUtils
Provides logic for screenshot and image manipulation and conversion.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.openqa.selenium.WebDriver
byte[]
Accepts the current alert window and takes a screenshot.static BufferedImage
toBufferedImage
(String fileName) Converts the file referenced by the argument file name to aBufferedImage
.
-
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
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:
NoSuchFileException
- if the argument file cannot be foundScreenshotNotCreatedException
- if a problem occurred during image conversionIOException
-