The code below is in yaml and is designed to allow for support in executing Java using an external java library.
Currently, I receive an error indicating that the Class could not be found.
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.sikuli.script.*
I have added the jar file to the folder name user-jars
as suggested here: https://stackoverflow.com/a/54560878/168617 and here: 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);
The Java.type()
API requires that you specify the name of a single Java class, so you cannot use wildcards. For example:
var Screen = Java.type("org.sikuli.script.Screen");
var screen = new Screen();
screen.click("C:/images/test.png", 0);