2016-05-10 9 views
0

Ich befolge dieses Tutorial: http://www.joecolantonio.com/2014/07/02/selenium-autoit-how-to-automate-non-browser-based-functionality/ zu automatisieren nicht-Browser-Anwendungen in Windows.Ausnahme im Thread "Haupt" com.jacob.com.ComFailException: Kann nicht gemeinsam erstellen Objekt

import java.io.File; 
import autoitx4java.AutoItX; 
import com.jacob.com.LibraryLoader; 

import java.lang.System; 

public class CalcTest { 

    /** 
    * 
    * Returns if the JVM is 32 or 64 bit version 
    */ 
    public static String jvmBitVersion(){ 
     return System.getProperty("sun.arch.data.model"); 
    } 

    public static void main(String[] args) throws InterruptedException { 

     String jacobDllVersionToUse; 
     if (jvmBitVersion().contains("32")){ 
      jacobDllVersionToUse = "jacob-1.18-x86.dll"; 
     } 
     else { 
      jacobDllVersionToUse = "jacob-1.18-x64.dll"; 
     } 

     File file = new File("lib", jacobDllVersionToUse); 
     System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath()); 

     AutoItX x = new AutoItX(); 
     x.run("calc.exe"); 
     x.winActivate("Calculator"); 
     x.winWaitActive("Calculator"); 
     //Enter 3 
     x.controlClick("Calculator", "", "133") ; 
     Thread.sleep(1000); 
     //Enter + 
     x.controlClick("Calculator", "", "93") ; 
     Thread.sleep(1000); 
     //Enter 3 
     x.controlClick("Calculator", "", "133") ; 
     Thread.sleep(1000); 
     //Enter = 
     x.controlClick("Calculator", "", "121") ; 
    } 

} 

bekomme ich folgende Fehlermeldung:

Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object 
    at com.jacob.com.Dispatch.createInstanceNative(Native Method) 
    at com.jacob.com.Dispatch.<init>(Dispatch.java:99) 
    at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58) 
    at autoitx4java.AutoItX.<init>(AutoItX.java:181) 
    at CalcTest.main(CalcTest.java:30) 

Das Tutorial sagt, dass ich regsvr32 C:\install\AutoItX\AutoItX3_x64.dll in cmd laufen sollte, aber ich bekomme immer folgende Fehlermeldung:

The module "C:\install\AutoItX\AutoItX3_x64.dll" was loaded but the call to DllRegisterServer failed with error code 0x80070005 

Ich bin nicht sicher was soll man daraus machen?

Antwort

0

Ich musste Cmd als Administrator ausführen. Möge es auch hier bleiben. Ich bin sicher, dass jemand sich im selben Boot eines Tages ...

-1

Ausführen als Administrator Login in cmd finden könnte und da Sie 64-Bit-Betriebssystem verwenden, führen Sie es auf dem Pfad C: \ Windows \ SysWOW64

und für 32-Bit-Ausführung im Pfad, C: \ Windows \ System32

- Swapna Mhatre

Verwandte Themen