← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #179984]: Can we capture screenshot failed test cases in test link

 

Question #179984 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/179984

    Status: Open => Answered

RaiMan proposed the following answer:
the basics:

Screen.capture returns a ScreenImage
(http://sikuli.org/doc/java-x/org/sikuli/script/ScreenImage.html), which
has a getImage method that returns a java.awt.image.BufferedImage. One
can use ImageIO.write to write this BufferedImage to disk with any
format that ImageIO supports.

in your case this should do what you want:
// needed imports
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.File;

// take screenshot and save image to a file
BufferedImage imgScreen = screen.capture().getImage();
ImageIO.write(imgScreen, "jpg", File("some-path/you-name-it.jpg"));

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.