本文整理汇总了Java中org.sikuli.script.Screen类的典型用法代码示例。如果您正苦于以下问题:Java Screen类的具体用法?Java Screen怎么用?Java Screen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Screen类属于org.sikuli.script包,在下文中一共展示了Screen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SikuliXAutomation
import org.sikuli.script.Screen; //导入依赖的package包/类
/**
*
* @param screen
* The Sikuli screen
*/
public SikuliXAutomation(Screen screen) {
SikuliXAutomation.SCREEN = screen;
Settings.MoveMouseDelay = MOVE_MOUSE_DELAY;
Settings.CheckLastSeen = CHECK_LAST_SEEN;
setMinSimilarity(DEFAULT_SIMILARITY);
if (System.getProperty("os.name").equals("Mac OS X")) {
screenshotpath = "screenshots/mac/";
}
if (System.getProperty("os.name").contains("Windows")) {
screenshotpath = "screenshots/windows/";
}
setSearchRegion(screen);
}
示例2: testSomething
import org.sikuli.script.Screen; //导入依赖的package包/类
@Test
public void testSomething() throws FindFailed {
App.focus("firefox");
Screen screen = new Screen();
goToURL(screen, "http://currentlabel.co.uk/flexuscalculus/");
screen.wait("src/images/pompei.png", 20);
Match pompei = screen.find("src/images/pompei.png");
pompei.setTargetOffset(70, 0);
pompei.click();
clearField(screen);
screen.type("0");
pompei.setTargetOffset(170, 0);
pompei.click();
clearField(screen);
screen.type("0");
pompei.setTargetOffset(270, 0);
pompei.click();
clearField(screen);
screen.type("0");
pompei.setTargetOffset(370, 0);
pompei.click();
clearField(screen);
screen.type("0");
pompei.setTargetOffset(470, 0);
pompei.click();
clearField(screen);
screen.type("0");
pompei.setTargetOffset(470, -70);
pompei.click(); // deselect last cell of popei row.
assertNotNull("Pompei row should be zeroed out",
screen.wait("src/images/pompeiRowOfZeros.png", 5));
}
示例3: findAll
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public List<Area> findAll(String fileName) throws QTasteException
{
try
{
List<Area> areas = new ArrayList<>();
Iterator<Match> it = Screen.all().findAll(loadImageFromPath(fileName));
while(it.hasNext())
{
Match m = it.next();
areas.add(new Area(m));
}
return areas;
}
catch(Exception ex)
{
throw new QTasteException(ex.getMessage(), ex);
}
}
示例4: SikuliElement
import org.sikuli.script.Screen; //导入依赖的package包/类
public SikuliElement(Screen sikuli, String image, String[] images, float similarity0to100, int x, int y) {
super();
this.sikuli = sikuli;
this.image = image;
this.images = images;
this.similarity0to100 = similarity0to100;
this.x = x;
this.y = y;
}
示例5: initElements
import org.sikuli.script.Screen; //导入依赖的package包/类
public static void initElements(Screen sikuli, Object page) {
Class<?> proxyIn = page.getClass();
while (proxyIn != Object.class) {
proxyFields(sikuli, page, proxyIn);
proxyIn = proxyIn.getSuperclass();
}
}
示例6: update
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public void update(EventSubject s) {
SneakyExceptionHandler.removeTemporaryUncaughtExceptionHandler();
Screen.closePrompt();
if (selectionErrorOccured ) {
Screen.resetPrompt((OverlayCapturePrompt) s);
return;
}
// This code is run in AWT thread. Using atomic reference to pass ScreenImage later to
// JavaFX thread.
AtomicReference<ScreenImage> atomicScreenImage = new AtomicReference<>(null);
// FIXME: a lot of stuff here is "Internal use" and "deprecated" in SikuliX library. Add
// unit tests to be able to notice any related problems before each release. Or some day the
// users might get angry.
if (s != null) {
OverlayCapturePrompt prompt = (OverlayCapturePrompt) s;
atomicScreenImage.set(prompt.getSelection());
}
Platform.runLater(() -> {
ScreenImage screenImage = atomicScreenImage.get();
if (screenImage != null) { // Image selected, selection wasn't cancelled.
setX(screenImage.x);
setY(screenImage.y);
setW(screenImage.w);
setH(screenImage.h);
}
});
Screen.resetPrompt((OverlayCapturePrompt) s);
}
示例7: getParentRegion
import org.sikuli.script.Screen; //导入依赖的package包/类
public Region getParentRegion(){
Rectangle parentRectangle = this.getParent().getRectangle();
if (parentRectangle == null || parentRectangle.getHeight() == 0 || parentRectangle.getWidth() == 0)
return new Screen();
return new Region(parentRectangle);
}
示例8: getRegion
import org.sikuli.script.Screen; //导入依赖的package包/类
private Region getRegion(String imageFilePath) throws QTasteTestFailException {
try {
return Screen.all().find(loadImageFromPath(imageFilePath));
} catch (FindFailed ex) {
throw new QTasteTestFailException("Cannot find the image on screen : " + ex.getMessage(), ex);
}
}
示例9: wait
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public void wait(String fileName, double timeout) throws QTasteException {
try {
Screen.all().wait(loadImageFromPath(fileName), timeout);
} catch (FindFailed ex) {
throw new QTasteTestFailException("Cannot find the image on screen : " + ex.getMessage(), ex);
}
}
示例10: dragDrop
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public void dragDrop(String targetFileName, String destinationFileName) throws QTasteException {
try {
Screen.all().dragDrop(loadImageFromPath(targetFileName), loadImageFromPath(destinationFileName));
} catch (FindFailed ex) {
throw new QTasteTestFailException("Cannot execute the Drag And Drop command : " + ex.getMessage(), ex);
}
}
示例11: type
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public void type(String fileName, String value) throws QTasteException {
try {
Screen.all().type(loadImageFromPath(fileName), value);
} catch (FindFailed ex) {
throw new QTasteTestFailException("Cannot execute the type command : " + ex.getMessage(), ex);
}
}
示例12: paste
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public void paste(String fileName, String value) throws QTasteException {
try {
Screen.all().paste(loadImageFromPath(fileName), value);
} catch (FindFailed ex) {
throw new QTasteTestFailException("Cannot execute the type command : " + ex.getMessage(), ex);
}
}
示例13: capture
import org.sikuli.script.Screen; //导入依赖的package包/类
@Override
public void capture(int x, int y, int w, int h, String filename) throws QTasteException {
try {
BufferedImage bi = Screen.all().capture(x, y, w, h).getImage();
ImageIO.write(bi, "png", new File(filename));
}
catch (Exception e) {
throw new QTasteException(e.getMessage());
}
}
示例14: DefaultCalculatorPage
import org.sikuli.script.Screen; //导入依赖的package包/类
public DefaultCalculatorPage(Screen sikuli) {
this.sikuli = sikuli;
SikuliFactory.initElements(sikuli, this);
}
示例15: MenuPage
import org.sikuli.script.Screen; //导入依赖的package包/类
public MenuPage(Screen sikuli) {
this.sikuli = sikuli;
SikuliFactory.initElements(sikuli, this);
}