Jump to content

Using AutoITX with Java (JACOB)


ShivaKumar
 Share

Recommended Posts

Here i was using the java selenium, AutoIT and JACOB.

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 );

Jacob file was in lib.

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.MethodInvocationHelper.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)
 

i'm getting this error. How to overcome this error.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...