jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

Another IAccessibleDLL.dll issue - Win 7 #118

Closed mxygem closed 6 years ago

mxygem commented 6 years ago

Heya!

Trying to run RAutomation via a local copy so that I can remove the mandatory 1 second sleep on the send_keys method however when trying to run my test I'm running into the following:

Could not open library 'l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32../../../../.
./ext/IAccessibleDLL/Release/iaccessibleDll.dll': The specified module could not be found.
       (LoadError)
      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32/functions.rb:8:in `<module:Functions
>'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32/functions.rb:5:in `<module:Win32>'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32/functions.rb:3:in `<module:Adapter>'

      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32/functions.rb:2:in `<module:RAutomati
on>'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32/functions.rb:1:in `<top (required)>'

      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32.rb:9:in `require'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/adapter/win_32.rb:9:in `<top (required)>'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/window.rb:67:in `require'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/window.rb:67:in `const_get'
      l:/code/jaysonesmith/RAutomation/lib/rautomation/window.rb:67:in `initialize'

If I change to the rubygems version, things work just fine for me. Any idea on what I can do to fix this?

Thanks!

enkessler commented 6 years ago

I'm dusting off this library myself so that I can use it on a project and I am running into a similar error. Rubygems copy on Windows 10 for me, however.

leviwilson commented 6 years ago

32-bit ruby?

mxygem commented 6 years ago

Both 32 and 64.

enkessler commented 6 years ago

2.4, 64-bit for me.

C:/Ruby/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ffi-1.9.18-x64-mingw32/lib/ffi/library.rb:147:in `block in ffi_lib': Could not open library 'C:/Ruby/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/win_32/../../../../ext/IAccessibleDLL/Release/iaccessibleDll.dll': �D� (LoadError)
leviwilson commented 6 years ago

I don't believe 64-bit would ever work because we don't package 64-bit DLLs that are loaded.

That doesn't address the 32-bit one though (haven't had a chance to look).

enkessler commented 6 years ago

Oh. RAutomation just doesn't support 64-bit Ruby at all. That...will be become increasingly problematic as time goes on.

Edit: switching to a 32-bit Ruby 2.4 has things running fine for me, now.

leviwilson commented 6 years ago

Automation would if 64-bit binaries were built and strategically loaded depending on the bit-ness of ruby.

For the uia gem that I wrote, I have a feature branch where I took a stab a long time ago at trying to do this...and it mostly works IIRC but I think I had some issues with the specs that I wasn't quite comfortable with releasing though.

https://github.com/northwoodspd/uia/tree/x64

enkessler commented 6 years ago

At the risk of derailing the thread and because I am a simple man: remind me why we use DLLS in the first place instead of going pure Ruby?

enkessler commented 6 years ago

Correction: it worked until I tried switching from the default adapter to the :ms_uia adapter. Now the DLL is having trouble again.

LoadError: Could not open library 'C:/Ruby/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/../../../../ext/UiaDll/Release/UiaDll.dll': The specified module could not be found.
leviwilson commented 6 years ago

The DLLs are used because straight up win32 calls are not enough to be able to drive automation via UI Automation and require either COM or like we do here, a managed C++ DLL that acts as the bridge into a C# DLL to more reliably interact with UI Automation.

So the absence of x64 is simply because the work hasn't been put in in order to compile both the x86 / x64 DLLs and package them.

The "specified module could not be found" sounds like it's a problem either with running 64-bit rubies or the absence of the 32-bit C++ runtime that is required. I can't exactly recall, but I think this one requires the VC++ 2010 runtime? It's either that or 2012.

jarmo commented 6 years ago

Closing this, but added a separate little section to README regarding 32bit vs 64bit Ruby because this issue keeps coming back.