带有Sikuli + Selenium Java代码的“java.lang.UnsatisfiedLinkError”

时间:2013-12-26 09:44:18

标签: java selenium selenium-webdriver sikuli

我正在尝试按照here提到的步骤学习Sikuli + Selenium集成。我按照提到的所有步骤进行操作,直到将jar文件添加到项目中并编写以下Java代码:

package sikuliseleniumpackage;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;

public class TestClass {

    /**
     * @param args
     * @throws FindFailed 
     */
    public static void main(String[] args) throws FindFailed {
        // TODO Auto-generated method stub
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");

        Pattern image = new Pattern("C:\\Images\\google_image.png");

        Screen screen = new Screen();

        screen.wait(image, 10);

    }

}

当我执行上面的代码时,抛出以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\abc\AppData\Local\Temp\tmplib\Win32Util.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
at org.sikuli.script.Win32Util.<clinit>(Win32Util.java:19)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at org.sikuli.script.Env.getOSUtil(Env.java:91)
at org.sikuli.script.ScreenHighlighter.init(ScreenHighlighter.java:180)
at org.sikuli.script.ScreenHighlighter.<init>(ScreenHighlighter.java:293)
at org.sikuli.script.Screen.initBounds(Screen.java:105)
at org.sikuli.script.Screen.<init>(Screen.java:117)
at sikuliseleniumpackage.TestClass.main(TestClass.java:22)

请帮我解决这个问题?

1 个答案:

答案 0 :(得分:0)

如果我没记错的话,即使您拥有64位计算机, 也可以使用32位JDK \ JRE来运行Sikuli。

即使你的错误消息说:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\abc\AppData\Local\Temp\tmplib\Win32Util.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

使用32位JDK \ JRE进行尝试。