0

I want to use sikulixapi with JMeter.

This is my code in the JMeter Beanshell sampler.

import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.sikuli.script.FindFailed;
import org.sikuli.script.KeyModifier;
import org.sikuli.script.Match;
import java.io.IOException;
Screen screen = new Screen();
Pattern VNCviewer = new Pattern ("C:\\patterns\\openvncviewer\\eclipse.png");
screen.click(VNCviewer);

Im getting the below error while executing the JMeter script.

Response code:500
Response message:org.apache.jorphan.util.JMeterException:
Error invoking bsh method: eval Sourced file: inline evaluation of: 
`` import org.sikuli.script.Pattern; import 
org.sikuli.script.Screen; import org.s . . . '' 
Typed variable declaration : Object constructor

Im using sikulixapi-2.0.5.jar and this jar has copied to the lib/ext folder.

Please let me know what is wrong here.

RJM
  • 271
  • 1
  • 5
  • 32

2 Answers2

0
  1. You need to put the jar to "lib" folder, "lib/ext" is for JMeter Components and Plugins

  2. sikulixapi-2.0.5.jar alone is not enough, you need to add its dependencies. Full list would be something like:

    animal-sniffer-annotations-1.17.jar
    ant-1.9.7.jar
    ant-launcher-1.9.7.jar
    antlr-3.5.2.jar
    antlr-runtime-3.5.2.jar
    asm-7.1.jar
    asm-analysis-7.1.jar
    asm-commons-7.1.jar
    asm-tree-7.1.jar
    asm-util-7.1.jar
    bcpkix-jdk15on-1.62.jar
    bcprov-jdk15on-1.62.jar
    checker-compat-qual-2.5.5.jar
    commons-beanutils-1.9.2.jar
    commons-cli-1.4.jar
    commons-collections-3.2.1.jar
    commons-compress-1.19.jar
    commons-exec-1.3.jar
    commons-io-2.8.0.jar
    commons-logging-1.2.jar
    error_prone_annotations-2.3.2.jar
    failureaccess-1.0.1.jar
    fontbox-2.0.21.jar
    ghost4j-1.0.1.jar
    guava-28.0-android.jar
    icu4j-59.1.jar
    itext-2.1.7.jar
    j2objc-annotations-1.3.jar
    jai-imageio-core-1.4.0.jar
    java-sizeof-0.0.5.jar
    javassist-3.22.0-GA.jar
    javax.servlet-api-3.1.0.jar
    jbig2-imageio-3.0.3.jar
    jboss-logging-3.1.4.GA.jar
    jboss-vfs-3.2.15.Final.jar
    jffi-1.2.19-native.jar
    jffi-1.2.20.jar
    jline-2.14.5.jar
    jna-5.6.0.jar
    jna-platform-5.6.0.jar
    jnr-a64asm-1.0.0.jar
    jnr-constants-0.9.12.jar
    jnr-ffi-2.1.10.jar
    jnr-netdb-1.1.6.jar
    jnr-posix-3.0.50.jar
    jnr-x86asm-1.0.2.jar
    jsr305-3.0.2.jar
    jython-slim-2.7.2.jar
    lept4j-1.13.2.jar
    listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
    log4j-1.2.17.jar
    netty-buffer-4.1.45.Final.jar
    netty-codec-4.1.45.Final.jar
    netty-common-4.1.45.Final.jar
    netty-handler-4.1.45.Final.jar
    netty-resolver-4.1.45.Final.jar
    netty-transport-4.1.45.Final.jar
    opencv-4.3.0-3.jar
    pdfbox-2.0.21.jar
    pdfbox-debugger-2.0.21.jar
    pdfbox-tools-2.0.21.jar
    py4j-0.10.9.1.jar
    reflections8-0.11.6.jar
    sikulix2tigervnc-1.1.4.jar
    sikulixapi-2.0.5.jar
    slf4j-api-1.7.30.jar
    slf4j-nop-1.7.28.jar
    ST4-4.0.8.jar
    tess4j-4.5.4.jar
    xmlgraphics-commons-1.4.jar
    
  3. Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting mainly because Groovy performance is much better, moreover Groovy has better Java compatibility and offers a lot of enhancements on top of normal Java SDK. See Apache Groovy - Why and How You Should Use It article for more information.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

Using the Maven coordinates for SikuliX 2.0.5 API should take care for the dependencies.

RaiMan from SikuliX

RaiMan
  • 1,088
  • 8
  • 13