开发者

java.lang.NoSuchFieldError: com.jacob.activeX.ActiveXComponent.m_pDispatch J

开发者 https://www.devze.com 2022-12-07 17:11 出处:网络
File file = new File("lib", "jacob-1.20-x64.dll"); System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
File file = new File("lib", "jacob-1.20-x64.dll");
    System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
    
    AutoItX x = new AutoItX();
      String Openfile = "Open";
try {
  Thread.sleep(2000);
} catch (InterruptedException e) {
  e.printStackTrace();
}
x.winActive(Openfile);
x.winWaitActive(Openfile);

    // Drive File select window using AutoIt
    x.controlClick("Open", "", "1001");
    x.send("C:\\MVS_TEAM\\MVS_Automation_Tests");
    x.send("{ENTER}!n", false );
    x.sleep(2000);
    x.controlClick("Open", "", "1");
    x.send(TemplateName);
    x.send("{ENTER}!n", false );
    x.sleep(1000);
    x.send("{ENTER}!n", false );

These are the script, i was using to connect the AutoIt with the help of Jacob. But facing some error, which i was mentioned below

java.lang.NoSuchFieldError: com.jacob.activeX.ActiveXComponent.m_pDispatch J

    at com.jacob.com.Dispatch.createInstanceNative(Native Method)
    at com.jacob.com.Dispatch.<init>(Dispatch.java:101)
    at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
    at autoitx4java.AutoItX.<init>(AutoItX.java:231)
    at StagingEnv_CAMS_Tests.Get_VW_Petrol_Stage.Test_Case(Get_VW_Petrol_Stage.java:181)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:577)
    at org.testng.internal.invokers.MethodInvocati开发者_C百科onHelper.invokeMethod(MethodInvocationHelper.java:139)
    at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677)
    at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221)
    at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
    at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:962)
    at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194)
    at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
    at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.testng.TestRunner.privateRun(TestRunner.java:806)
    at org.testng.TestRunner.run(TestRunner.java:601)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:433)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:427)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:387)
    at org.testng.SuiteRunner.run(SuiteRunner.java:330)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
    at org.testng.TestNG.runSuites(TestNG.java:1099)
    at org.testng.TestNG.run(TestNG.java:1067)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

The Jacob and AutoIt jar in lib and autoItX.dll is registered successfully. The issue was in jacob, in which way can i sort out the issue???

0

精彩评论

暂无评论...
验证码 换一张
取 消