本文整理汇总了Java中org.sikuli.script.Key类的典型用法代码示例。如果您正苦于以下问题:Java Key类的具体用法?Java Key怎么用?Java Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Key类属于org.sikuli.script包,在下文中一共展示了Key类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: pageDown
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* Press page down given number of times
*/
@Action(object = ObjectType.APP, desc = "Perform page down [<Data>] times", input = InputType.YES)
public void pageDown() {
try {
int count = 1;
if (Data != null) {
count = Integer.valueOf(Data);
}
for (int i = 1; i <= count; i++) {
SCREEN.type(Key.PAGE_DOWN);
}
Report.updateTestLog(Action, "PageDown [" + Data + "] action is done",
Status.DONE);
} catch (Exception ex) {
Report.updateTestLog(Action, ex.getMessage(), Status.FAIL);
Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
}
}
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:23,代码来源:Application.java
示例2: Assignsalesman
import org.sikuli.script.Key; //导入依赖的package包/类
public void Assignsalesman(WebDriver driver,String strqdname) throws InterruptedException{
PageExist.PageExist("item-pnm","item-pnm71","toolbarPluginpnm71Frame",driver);
driver.findElement(By.name("query")).click();
driver.findElement(By.name("query")).sendKeys(strqdname);
Thread.sleep(1000);
driver.findElement(By.linkText("查询")).click();
Thread.sleep(1000);
driver.findElement(By.linkText("分配销售")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[@class='table-popovers']/form[1]/input[1]")).click();
Thread.sleep(1000);
driver.findElement(By.xpath("//div[@class='table-popovers']/form[1]/input[1]")).sendKeys("sunyan");
Thread.sleep(1000);
driver.findElement(By.xpath("//div[@class='table-popovers']/form[1]/input[1]")).sendKeys(Key.ENTER);
Thread.sleep(1000);
//driver.findElement(By.xpath("//div[@class='table-popovers']/form[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[3]/td[1]/span")).click();
//Thread.sleep(1000);
driver.findElement(By.linkText("确定")).click();
Thread.sleep(1000);
}
开发者ID:pcsh,项目名称:cashion,代码行数:23,代码来源:AssignTask.java
示例3: typeKeys
import org.sikuli.script.Key; //导入依赖的package包/类
public void typeKeys(String keys, Object... modifiers) {
boolean numLockActive = Key.isLockOn(Key.C_NUM_LOCK);
if (numLockActive) {
Helper.getRegion().type(Key.NUM_LOCK);
}
String modifierText = "";
for (Object modifier : modifiers) {
modifierText = modifierText + KeyMapper.getKey(modifier.toString());
SikuliLogger.logDebug(modifier+" => "+modifierText);
}
keys = KeyMapper.getKey(keys);
if (modifierText.length() > 0) {
Helper.getRegion().type(keys, modifierText);
} else {
Helper.getRegion().type(keys);
}
if (numLockActive) {
Helper.getRegion().type(Key.NUM_LOCK);
}
}
开发者ID:Hi-Fi,项目名称:remotesikulilibrary,代码行数:23,代码来源:Server.java
示例4: pageDownBrowser
import org.sikuli.script.Key; //导入依赖的package包/类
public void pageDownBrowser(int dh) {
if (isHeadless()) {
SCREEN.type(Key.PAGE_DOWN);
} else {
dh = Math.max(0, dh);
JavascriptExecutor jse = ((JavascriptExecutor) Driver);
jse.executeScript(String.format("window.scrollBy(0, window.innerHeight-%s)", dh));
}
}
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:10,代码来源:ImageCommand.java
示例5: hideFocusedProgram
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* Minimizes the current focused program
*/
public static void hideFocusedProgram() {
if (System.getProperty("os.name").equals("Mac OS X")) {
SCREEN.type("h", KeyModifier.CMD);
}
if (System.getProperty("os.name").contains("Windows")) {
SCREEN.type(Key.DOWN, KeyModifier.WIN);
}
}
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:12,代码来源:SikuliXGUIAutomations.java
示例6: unhideMidiAutomator
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* Shows the Midi Automator main window when it was hidden.
*
* @throws FindFailed
*/
public static void unhideMidiAutomator() throws FindFailed {
// show Midi Automator
if (System.getProperty("os.name").equals("Mac OS X")) {
SCREEN.type(Key.TAB, Key.CMD);
}
if (System.getProperty("os.name").contains("Windows")) {
SCREEN.type(Key.TAB, Key.ALT);
SCREEN.type(Key.TAB, Key.ALT);
}
}
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:16,代码来源:SikuliXGUIAutomations.java
示例7: closeFocusedProgram
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* Closes the current focused program.
*/
public static void closeFocusedProgram() {
try {
if (System.getProperty("os.name").equals("Mac OS X")) {
SCREEN.type("q", Key.CMD);
}
if (System.getProperty("os.name").contains("Windows")) {
SCREEN.type(Key.F4, KeyModifier.WIN | KeyModifier.ALT);
}
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:18,代码来源:SikuliXAutomation.java
示例8: pasteClipboard
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* pastes the current clipboard content into the focused area. Will do the same as "CTRL + C".
*
* @return this {@link Environment}.
*/
@ModifySahiTimer
@LogToResult(message = "paste the current clipboard into the focus", logClassInstance = false)
public Environment pasteClipboard() {
int mod = Key.getHotkeyModifier();
IRobot r = loader.getScreen().getRobot();
r.keyDown(mod);
r.keyDown(KeyEvent.VK_V);
r.keyUp(KeyEvent.VK_V);
r.keyUp(mod);
return this;
}
开发者ID:ConSol,项目名称:sakuli,代码行数:17,代码来源:Environment.java
示例9: copyIntoClipboard
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* copy the current selected item or text to the clipboard. Will do the same as "CTRL + V".
*
* @return this {@link Environment}.
*/
@ModifySahiTimer
@LogToResult(message = "copy the current selection to the clipboard", logClassInstance = false)
public Environment copyIntoClipboard() {
int mod = Key.getHotkeyModifier();
IRobot r = loader.getScreen().getRobot();
r.keyDown(mod);
r.keyDown(KeyEvent.VK_C);
r.keyUp(KeyEvent.VK_C);
r.keyUp(mod);
return this;
}
开发者ID:ConSol,项目名称:sakuli,代码行数:17,代码来源:Environment.java
示例10: sikuliClickAndType
import org.sikuli.script.Key; //导入依赖的package包/类
@Test
public void sikuliClickAndType() {
WebDriver driver = null;
Desktop desktop = new Desktop();
try {
IImageElement inputSearch = new ImageElement(ClassLoader.getSystemResource("inputSearch.png").getPath(), 0.75f);
IImageElement linkSite = new ImageElement(ClassLoader.getSystemResource("linkSite.png").getPath(), 0.75f);
IImageElement linkAllCategories = new ImageElement(ClassLoader.getSystemResource("linkAllCategories.png").getPath(), 0.75f);
IImageElement linkProgramming = new ImageElement(ClassLoader.getSystemResource("linkProgramming.png").getPath(), 0.75f);
driver = new FirefoxDriver();
driver.get("https://www.google.ru/");
desktop.type(inputSearch, "automated-testing.into" + Key.ENTER, 2);
desktop.clickAll(new IImageElement[] { linkSite, linkAllCategories, linkProgramming }, 20);
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (driver != null) {
driver.quit();
}
}
}
开发者ID:atinfo,项目名称:at.info-knowledge-base,代码行数:28,代码来源:CommonSikuliActionsTests.java
示例11: getText
import org.sikuli.script.Key; //导入依赖的package包/类
public String getText() {
clearClipboard();
type("a", Key.CTRL);
sikuli.type("c", Key.CTRL);
return getClipboard();
}
开发者ID:marcoslimaqa,项目名称:sikuli-factory,代码行数:7,代码来源:SikuliElement.java
示例12: getKeyCode
import org.sikuli.script.Key; //导入依赖的package包/类
public String getKeyCode(String data) {
switch (data.toUpperCase()) {
case "TAB":
return Key.TAB;
case "ENTER":
return Key.ENTER;
case "SHIFT":
return Key.SHIFT;
case "CTRL":
return Key.CTRL;
case "ALT":
return Key.ALT;
case "START":
return Key.WIN;
case "ESC":
return Key.ESC;
case "DELETE":
return Key.DELETE;
case "BACKSPACE":
return Key.BACKSPACE;
case "HOME":
return Key.HOME;
case "CAPS_LOCK":
case "CAPS LOCK":
return Key.CAPS_LOCK;
case "PAGE_UP":
case "PAGEUP":
return Key.PAGE_UP;
case "PAGE_DOWN":
case "PAGEDOWN":
return Key.PAGE_DOWN;
case "UP":
return Key.UP;
case "DOWN":
return Key.DOWN;
case "LEFT":
return Key.LEFT;
case "RIGHT":
return Key.RIGHT;
default:
return data;
}
}
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:46,代码来源:ImageCommand.java
示例13: findStyle
import org.sikuli.script.Key; //导入依赖的package包/类
@Test
public void findStyle() throws InterruptedException, FindFailed {
String URL="http://beta.onlyou.com:8888/admin/";
//System.setProperty("webdriver.chrome.driver", "E:\\seleniumS\\chromedriver_win32\\chromedriver.exe");
//WebDriver driver = new ChromeDriver();
WebDriver driver = new FirefoxDriver();
driver.get(URL);
//max size the browser
driver.manage().window().maximize();
Thread.sleep(2000);
Screen s = new Screen();
s.click("name.png");
Thread.sleep(2000);
s.type("omp");
s.type(Key.SHIFT);
s.click("passwd.png");
Thread.sleep(2000);
s.type("123456");
s.click("login.png");
Thread.sleep(5000);
s.click("manage.png");
s.click("hetong.png");
Thread.sleep(2000);
s.click("add.png");
Thread.sleep(5000);
s.click("fujian.png");
s.click("upload.png");
s.click("open.png");
Thread.sleep(2000);
s.click("qudaoname.png");
Thread.sleep(1000);
s.click("onlyou.png");
s.click("time1.png");
s.click("time11.png");
s.click("time2.png");
s.click("time22.png");
s.click("time3.png");
s.click("time55.png");
s.click("time4.png");
s.click("time44.png");
s.click("time5.png");
s.click("time33.png");
s.click("money.png");
s.type("5000");
s.click("luru.png");
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
s.type(Key.DOWN);
Thread.sleep(2000);
s.click("shoukuan.png");
s.click("shoukuanname.png");
s.click("num1.png");
s.click("num11.png");
s.click("num2.png");
s.click("num22.png");
s.click("save.png");
Thread.sleep(2000);
}
开发者ID:pcsh,项目名称:cashion,代码行数:76,代码来源:SikuliExample.java
示例14: create
import org.sikuli.script.Key; //导入依赖的package包/类
public void create(WebDriver driver,String strqdname) throws InterruptedException, FindFailed{
PageExist.PageExist("item-pnm","item-pnm80","toolbarPluginpnm80Frame",driver);
driver.findElement(By.linkText("新增")).click();
Thread.sleep(4000);
driver.switchTo().defaultContent();
driver.switchTo().frame("toolbarPluginaddContractFrame");
Thread.sleep(1000);
driver.findElement(By.xpath("//form[@id='formStep1']/div[1]/div[1]/ul[1]/li[1]/label[2]/input[1]")).click();
Thread.sleep(1000);
driver.findElement(By.xpath("//form[@id='formStep1']/div[1]/div[1]/ul[1]/li[1]/label[2]/input[1]")).sendKeys(strqdname);
Thread.sleep(2000);
driver.findElement(By.xpath("//form[@id='formStep1']/div[1]/div[1]/ul[1]/li[1]/label[2]/input[1]")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
driver.findElement(By.id("signDate")).click();
Thread.sleep(2000);
driver.findElement(By.id("signDate")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
driver.findElement(By.name("contractDateStart")).click();
Thread.sleep(1000);
driver.findElement(By.name("contractDateStart")).sendKeys("2016-06-01");
Thread.sleep(1000);
driver.findElement(By.name("contractDateEnd")).click();
Thread.sleep(1000);
driver.findElement(By.name("contractDateEnd")).sendKeys("2017-06-01");
Thread.sleep(1000);
Screen s = new Screen();
s.find("1.png");
s.click("1.png");
Thread.sleep(1000);
driver.findElement(By.name("contractOperationStart")).click();
Thread.sleep(1000);
driver.findElement(By.name("contractOperationStart")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
driver.findElement(By.name("contractOperationEnd")).click();
Thread.sleep(1000);
driver.findElement(By.name("contractOperationEnd")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
driver.findElement(By.name("contractDeposit")).click();
driver.findElement(By.name("contractDeposit")).sendKeys("20000");
Thread.sleep(1000);
driver.findElement(By.xpath("//label[@id='chargeItesCheckBoxLabel']/em[1]")).click();
Thread.sleep(1000);
s.find("上传附件.png");
s.click("上传附件.png"); //click p
s.find("文件名.png"); //identify play button
s.type(Key.SHIFT);
s.type("文件名.png","D:\\work\\test\\vop\\54756db99392d.jpg"); //click play button
s.find("打开.png");
s.click("打开.png");
// driver.findElement(By.id("SWFUpload_0")).click();打开
// driver.findElement(By.xpath("//div[@id='uploadOper']/div[1]/div[1]/div[1]/object[1]")).click();
//sendKeys("C:\\Users\\岩\\Desktop\\184270249.jpg");
// Thread.sleep(1000);
// driver.findElement(By.id("SWFUpload_0")).sendKeys("C:\\Users\\岩\\Desktop\\184270249.jpg");
Thread.sleep(1000);
driver.findElement(By.xpath("//*[@componentconfigext='pageObj.payToConfigExt']")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("//*[@componentconfigext='pageObj.payToConfigExt']")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
driver.findElement(By.name("accountsDate")).click();
Thread.sleep(1000);
driver.findElement(By.name("accountsDate")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
driver.findElement(By.name("payDate")).click();
Thread.sleep(1000);
driver.findElement(By.name("payDate")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
Thread.sleep(1000);
driver.findElement(By.linkText("保存")).click();
Thread.sleep(1000);
}
开发者ID:pcsh,项目名称:cashion,代码行数:80,代码来源:PartnerContract.java
示例15: clearField
import org.sikuli.script.Key; //导入依赖的package包/类
private void clearField(Screen screen) {
screen.type("a", KeyModifier.CMD);
screen.type(Key.BACKSPACE);
}
开发者ID:paul-hammant,项目名称:MySikuliExample,代码行数:5,代码来源:MySikuliTest.java
示例16: getHotkeyModifier
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* @return System dependent key
*/
public static int getHotkeyModifier() {
return Key.getHotkeyModifier();
}
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:7,代码来源:Do.java
示例17: isLockOn
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* getAll the lock state of the given key
*
* @param key respective key specifier according class Key
* @return true/false
*/
public static boolean isLockOn(char key) {
return Key.isLockOn(key);
}
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:10,代码来源:Do.java
示例18: addHotkey
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* @param key respective key specifier according class Key
* @param modifiers respective key specifier according class KeyModifiers
* @param listener a HotKeyListener instance
* @return true if ok, false otherwise
*/
public static boolean addHotkey(String key, int modifiers, HotkeyCallback listener) {
return Key.addHotkey(key, modifiers, listener);
}
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:10,代码来源:Do.java
示例19: removeHotkey
import org.sikuli.script.Key; //导入依赖的package包/类
/**
* @param key respective key specifier according class Key
* @param modifiers respective key specifier according class KeyModifiers
* @return true if ok, false otherwise
*/
public static boolean removeHotkey(String key, int modifiers) {
return Key.removeHotkey(key, modifiers);
}
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:9,代码来源:Do.java
注:本文中的org.sikuli.script.Key类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论