在Sikuli X我可以使用类似的东西
type("x", KEY_CTRL)
我怎样才能在Sikuli API中做同样的事情?
我在我的项目中这样使用:
Screen screen = new Screen();
screen.click(<your texbox>); // click into textbox to have a cursor there
screen.type("a", KeyModifier.CTRL); // this sends Ctrl+"a" to select all text <- this is what you asked for !
screen.type(Key.BACKSPACE); // this sends Backspace key pressed, i.e. here deletes all selected text
请注意,我同时使用了 KeyModifier 和 Key。这样它就起作用了。
试试这个,
Screen screen = new Screen();
screen.type("x",Key.CTRL)
screen.type("\n");
使用KeyEvent中的键码:
DesktopKeyboard keyboard = new DesktopKeyboard();
keyboard.keyDown(KeyEvent.VK_CONTROL);
keyboard.type("x");
keyboard.keyUp(KeyEvent.VK_CONTROL);