unknown OLE server: ‘AutoItX3.Control’ (WIN32OLERuntimeError)
Symptom
Following error is displayed when we run the script,
>ruby test.rb
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie.rb:114:in `initialize': unknown OLE server: `AutoItX3.Control' (WIN32OLERuntimeError)
HRESULT error code:0x800401f3
Invalid class string
from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie.rb:114:in `new'
from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie.rb:114:in `autoit'
from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb:438:in `autoit'
from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb:426:in `bring_to_front'
from test.rb:6
>Exit code: 1
Solution
You need to register AutoIt.
In a command window, navigate to the directory where you've put AutoIt and type:
regsvr32 AutoItX3.dll
My directory is C:\Ruby\lib\ruby\gems\1.8\gems\watir-1.6.5\lib\watir\AutoItX3.dll.
Also can use below command to register AutoIt.
regsvr32 C:\Ruby\lib\ruby\gems\1.8\gems\watir-1.6.5\lib\watir\AutoItX3.dll (For Ruby 1.8.6)
regsvr32 C:\Ruby187\lib\ruby\gems\1.8\gems\watir-1.6.5\lib\watir\AutoItX3.dll (For Ruby 1.8.7)
After the above action, I got the error message is as following,
The module "AutoItX3.dll" was loaded but the call to DllRegisterServer failed with error code 0x80070005.
Solution
Return code was: 0x80070005
If you are logged on with a user account that does NOT have administrative privileges, you will experience this behavior if the DLL file writes to the registry, or changes files in the %SystemRoot%\System32 folder.
To workaround this behavior, log on with an account that has administrative privileges.