如何将 Sikuli JAR 文件添加到 OpenTest 以允许在 Windows 7 上实现自动化?
How do I add Sikuli JAR file to OpenTest allowing for automation on Windows 7?
下面的代码在 yaml 中,旨在支持使用外部 java 库执行 Java。
目前,我收到一条错误消息,指出找不到 Class。
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.sikuli.script.*
我已按照此处的建议将 jar 文件添加到文件夹名称 user-jars
: and here: https://getopentest.org/docs/scripting-support.html#advanced-concepts
#
# https://getopentest.org/docs/scripting-support.html#advanced-concepts
description: Login using SikuliX as driver
actors:
- actor: WEB
segments:
- segment: 1
actions:
- description: Get content of file
- script: |
var Sikuli = Java.type("org.sikuli.script.*")
var Files = Java.type("java.nio.file.Files");
var Paths = Java.type("java.nio.file.Paths");
var System = Java.type("java.lang.System");
var JavaString = Java.type("java.lang.String");
var content = new JavaString(Files.readAllBytes(Paths.get("C:/content.txt")), "UTF-8");
System.out.println(content);
Java.type()
API需要指定单个Javaclass的名称,所以不能使用通配符。例如:
var Screen = Java.type("org.sikuli.script.Screen");
var screen = new Screen();
screen.click("C:/images/test.png", 0);
下面的代码在 yaml 中,旨在支持使用外部 java 库执行 Java。
目前,我收到一条错误消息,指出找不到 Class。
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.sikuli.script.*
我已按照此处的建议将 jar 文件添加到文件夹名称 user-jars
:
#
# https://getopentest.org/docs/scripting-support.html#advanced-concepts
description: Login using SikuliX as driver
actors:
- actor: WEB
segments:
- segment: 1
actions:
- description: Get content of file
- script: |
var Sikuli = Java.type("org.sikuli.script.*")
var Files = Java.type("java.nio.file.Files");
var Paths = Java.type("java.nio.file.Paths");
var System = Java.type("java.lang.System");
var JavaString = Java.type("java.lang.String");
var content = new JavaString(Files.readAllBytes(Paths.get("C:/content.txt")), "UTF-8");
System.out.println(content);
Java.type()
API需要指定单个Javaclass的名称,所以不能使用通配符。例如:
var Screen = Java.type("org.sikuli.script.Screen");
var screen = new Screen();
screen.click("C:/images/test.png", 0);