使用 Sikuli 和 Env.isLockOn(Key.NUM_LOCK) 单击图像不起作用
Clicking on Image using Sikuli and Env.isLockOn(Key.NUM_LOCK) not working
我正在尝试点击图片,我还需要检查 NUM_LOCK 是否打开或关闭,如果它打开了,如果关闭,我需要切换,为此我正在使用下面的 sikuli 脚本和 运行 它使用 seleniumDriver 代码的 executescript 命令如下,但它给我的错误是
"Exception Occured ::org.openqa.selenium.WebDriverException: No signature of
method: static org.sikuli.script.Env.isLockOn() is applicable for argument
types: (java.lang.String) values: [?]
Possible solutions: isLockOn(char)"
代码下方
String typeFromDate = "import org.sikuli.script.Screen;\n"+
"import org.sikuli.script.Key;\n"+
"import org.sikuli.script.KeyModifier;\n"+
"import org.sikuli.script.Env;\n"+
"Screen screen = new Screen();\n"+
"screen.doubleClick(\""+fromDateImgPath.trim()+"\");\n"+
"Thread.sleep(2000);\n"+
"if(Env.isLockOn(Key.NUM_LOCK))screen.type(Key.NUM_LOCK);"+
"screen.type(Key.HOME); \n"+
"Thread.sleep(5000);\n"+
"screen.keyDown(Key.SHIFT) \n"+
"screen.type(Key.END) \n"+
"screen.keyUp(Key.SHIFT) \n"+
"Thread.sleep(5000);\n"+
"screen.type(\""+fromDate+"\"); \n"+
"Thread.sleep(2000);\n"+
"return null;\n";
returnfrDt = (String) aDriver.executeScript(typeFromDate, new String[]
{"GROOVY"});
使用 Jython,这非常简单:
if Env.isLockOn(Key.NUM_LOCK):
print('NUM_LOCK is ON')
我正在尝试点击图片,我还需要检查 NUM_LOCK 是否打开或关闭,如果它打开了,如果关闭,我需要切换,为此我正在使用下面的 sikuli 脚本和 运行 它使用 seleniumDriver 代码的 executescript 命令如下,但它给我的错误是
"Exception Occured ::org.openqa.selenium.WebDriverException: No signature of
method: static org.sikuli.script.Env.isLockOn() is applicable for argument
types: (java.lang.String) values: [?]
Possible solutions: isLockOn(char)"
代码下方
String typeFromDate = "import org.sikuli.script.Screen;\n"+
"import org.sikuli.script.Key;\n"+
"import org.sikuli.script.KeyModifier;\n"+
"import org.sikuli.script.Env;\n"+
"Screen screen = new Screen();\n"+
"screen.doubleClick(\""+fromDateImgPath.trim()+"\");\n"+
"Thread.sleep(2000);\n"+
"if(Env.isLockOn(Key.NUM_LOCK))screen.type(Key.NUM_LOCK);"+
"screen.type(Key.HOME); \n"+
"Thread.sleep(5000);\n"+
"screen.keyDown(Key.SHIFT) \n"+
"screen.type(Key.END) \n"+
"screen.keyUp(Key.SHIFT) \n"+
"Thread.sleep(5000);\n"+
"screen.type(\""+fromDate+"\"); \n"+
"Thread.sleep(2000);\n"+
"return null;\n";
returnfrDt = (String) aDriver.executeScript(typeFromDate, new String[]
{"GROOVY"});
使用 Jython,这非常简单:
if Env.isLockOn(Key.NUM_LOCK):
print('NUM_LOCK is ON')