本文整理汇总了Java中org.sikuli.script.App类的典型用法代码示例。如果您正苦于以下问题:Java App类的具体用法?Java App怎么用?Java App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
App类属于org.sikuli.script包,在下文中一共展示了App类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openApp
import org.sikuli.script.App; //导入依赖的package包/类
/**
* Open the given Application
*/
@Action(object = ObjectType.APP,
desc = "Open the Application [<Data>]",
input = InputType.YES)
public void openApp() {
try {
String loc, id;
if (Data.contains(",")) {
loc = Data.split(",")[0];
id = Data.split(",")[1];
} else {
id = loc = Data;
}
appList.put(id, App.open(loc));
Report.updateTestLog(Action, "Open action is done", Status.DONE);
Thread.sleep(1000);
} catch (Exception ex) {
Report.updateTestLog(Action, ex.getMessage(), Status.FAIL);
Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例2: testSomething
import org.sikuli.script.App; //导入依赖的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: open
import org.sikuli.script.App; //导入依赖的package包/类
/**
* Opens the created application. For loadtime intensiv application change the default sleep time with {@link
* #setSleepTime(Integer)}.
*
* @return this {@link Application}.
*/
@LogToResult(message = "open application")
@Override
public Application open() {
App app = super.open();
if (app == null) {
loader.getExceptionHandler().handleException("Application '" + this.getName() + " could not be opened! ... Please check the application name or path!", resumeOnException);
return null;
}
/*** automatic sleep for long loading applications, see {@link #setSleepTime(Integer)} **/
sleep(sleepMillis);
final String appID = "" + app.getName() +
((app.getPID() != null && app.getPID() > 0) ? " PID:" + app.getPID() : "");
final int tries = 5;
LOGGER.debug("verify app " + appID + " is running");
if (!app.isRunning(tries)) {
LOGGER.warn("verified {} times if application '" + appID + "' is running", tries);
loader.getExceptionHandler().handleException("Application '" + appID + "' failed to open or is not running", resumeOnException);
}
LOGGER.info("Application '" + appID + "' is running");
return this;
}
示例4: closeApp
import org.sikuli.script.App; //导入依赖的package包/类
public void closeApp(String appCommand) {
if (isInteger(appCommand)) {
try {
new App(Integer.parseInt(appCommand)).close();
} catch (NullPointerException e) {
SikuliLogger.log("Application not found with given PID. Maybe it's closed earlier?");
SikuliLogger.logDebug(e.getStackTrace());
}
} else {
App.close(appCommand);
}
}
示例5: switchApp
import org.sikuli.script.App; //导入依赖的package包/类
public void switchApp(String appCommand) {
if (isInteger(appCommand)) {
new App(Integer.parseInt(appCommand)).focus();
} else {
App.focus(appCommand);
}
}
示例6: getRegionFromFocusedWindow
import org.sikuli.script.App; //导入依赖的package包/类
/**
* @return a {@link Region} object from the current focused window or NULL on errors.
*/
@LogToResult(logClassInstance = false)
public Region getRegionFromFocusedWindow() {
org.sikuli.script.Region origRegion = App.focusedWindow();
if (origRegion != null) {
return new Region(origRegion, resumeOnException);
}
loader.getExceptionHandler().handleException("couldn't extract a Region from the current focused window", resumeOnException);
return null;
}
示例7: focusWindow
import org.sikuli.script.App; //导入依赖的package包/类
/**
* focus a specific window of the application.
*
* @param windowNumber indemnifies the window
* @return this {@link Application}.
*/
@LogToResult(message = "focus application in window")
public Application focusWindow(Integer windowNumber) {
LOGGER.debug("Focus window \"" + windowNumber + "\" in application \"" + getName() + "\".");
App app = super.focus(windowNumber);
if (app == null) {
LOGGER.warn("Application '{}' could not be focused! ... Please check if the application has been opened before or is already focused!", getName());
return this;
}
/*** automatic sleep for long loading applications, see {@link #setSleepTime(Integer)} **/
sleep(sleepMillis);
return this;
}
示例8: before
import org.sikuli.script.App; //导入依赖的package包/类
@Before
public void before() {
sikuli = new Screen();
ImagePath.add("src/test/resources/sikuli-images/win-10-calculator.sikuli");
sikuliApp = App.open("calc.exe");
}
示例9: runFirst
import org.sikuli.script.App; //导入依赖的package包/类
@Override
public void runFirst() {
virtualIndex = slider.getVirtualPartIndex(virtualparts);
r = App.focusedWindow();
prev = Mouse.at();
}
示例10: updateRegionToFocusedApp
import org.sikuli.script.App; //导入依赖的package包/类
public void updateRegionToFocusedApp() {
Helper.setRegion(App.focusedWindow());
SikuliLogger.log(Helper.getRegion());
}
示例11: startApp
import org.sikuli.script.App; //导入依赖的package包/类
public int startApp(String appCommand) {
return App.open(appCommand).getPID();
}
示例12: getClipboard
import org.sikuli.script.App; //导入依赖的package包/类
/**
* @return the current content of the clipboard as {@link String} or NULL on errors
*/
@LogToResult(message = "get string from system clipboard", logClassInstance = false)
public String getClipboard() {
return App.getClipboard();
}
示例13: setClipboard
import org.sikuli.script.App; //导入依赖的package包/类
/**
* sets the String parameter to the system clipboard
*
* @param text as {@link String}
* @return this {@link Environment}.
*/
@LogToResult(message = "put to clipboard", logClassInstance = false)
public Environment setClipboard(String text) {
App.setClipboard(text);
return this;
}