下面的代码在 yaml 中,旨在支持使用外部 Java 库执行 Java。
目前,我收到一条错误消息,指出找不到该类。
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.sikuli.script.*
user-jars
我已按照此处的建议将 jar 文件添加到文件夹名称:https://stackoverflow.com/a/54560878/168617和此处:https : //getopentest.org/docs/scripting-support.html#advanced-concepts
# https://stackoverflow.com/a/54560878/168617
# 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);