Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/com/opera/core/systems/OperaWebElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,22 @@ public String saveScreenshot(String filename, long timeout, boolean includeImage
exec.screenWatcher(canvas, timeout, includeImage, hashes);

if (includeImage && reply.getPng() != null) {
FileChannel stream;
FileChannel stream = null;

try {
stream = new FileOutputStream(filename).getChannel();
stream.write(ByteBuffer.wrap(reply.getPng()));
stream.close();
} catch (IOException e) {
throw new WebDriverException("Failed to write file: " + e.getMessage(), e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
throw new WebDriverException("Failed to close file channel stream: " + e.getMessage(), e);
}
}
}
}

Expand Down