jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

Could not open library "iaccessibleDll.dll" #101

Closed ghost closed 8 years ago

ghost commented 8 years ago

I've made a simple test, but my script fails with "Could not find 'ffi'" error. Thank you for any help!

require 'rubygems'
require "rautomation"

window = RAutomation::Window.new(:title => /Preventivo/i)
window.exists? # => true

Gets the failure:

C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'ffi' (= 1.9.3) among 18 total gem
(s) (Gem::LoadError)
Checked in 'GEM_PATH=C:/Users/testa/.gem/ruby/2.2.0;C:/Ruby22-x64/lib/ruby/gems/2.2.0', execute `gem env` for more infor
mation
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
        from preventivo-automation.rb:2:in `<main>'

gem env:

C:\Users\testa>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5
  - RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby22-x64/lib/ruby/gems/2.2.0
  - RUBY EXECUTABLE: C:/Ruby22-x64/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby22-x64/bin
  - SPEC CACHE DIRECTORY: C:/Users/testa/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/Ruby22-x64/lib/ruby/gems/2.2.0
     - C:/Users/testa/.gem/ruby/2.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - C:\Windows\system32
     - C:\Windows
     - C:\Windows\System32\Wbem
     - C:\Windows\System32\WindowsPowerShell\v1.0\
     - C:\Ruby22-x64\bin

gem list

C:\Users\testa>gem list

*** LOCAL GEMS ***

bigdecimal (1.2.6)
bundler (1.10.5)
ffi (1.9.10 x64-mingw32)
io-console (0.4.3)
json (1.8.1)
log4r (1.1.10)
minitest (5.4.3)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rautomation (0.17.0)
rdoc (4.2.0)
test-unit (3.0.8)
win32-api (1.5.3 universal-mingw32)
win32-autogui (0.5.2)
win32-clipboard (0.5.2)
win32-process (0.6.6)
windows-api (0.4.4)
windows-pr (1.2.4)
jarmo commented 8 years ago

I'm not sure why you're having this problem, but it might be caused by the fact that you're using 64bit Ruby. Can you try the same thing with using 32bit Ruby instead?

ghost commented 8 years ago

That's right. 32bit runs all right.

pradeepta02 commented 7 years ago

I am using rautomation to automate our windows application. However whenever I am trying to click on some button, it's throwing error message as specified below:

C:\Users\vagrant>gem list

* LOCAL GEMS *

bigdecimal (1.2.6) ffi (1.9.14 x86-mingw32) io-console (0.4.3) json (1.8.1) minitest (5.4.3) power_assert (0.2.2) psych (2.0.8) rake (10.4.2) rautomation (0.17.0) rdoc (4.2.0) require_all (1.3.3) test-unit (3.0.8) uia (0.6)

Ruby Version: ruby 2.2.3p173 (2015-08-18 revision 51636) [i386-mingw32] OS: Windows7 64 bit

irb(main):006:0> win = RAutomation::Window.new :title=>'Windows Task Manager', :adapter=>'ms_uia' => #<RAutomation::Window:0x2c7c9d8 @adapter="ms_uia", @window=#<RAutomation::Adapter::MsUia::Window:0x2c7c900 @cont ainer=#<RAutomation::Window:0x2c7c9d8 ...>, @locators={:index=>0, :title=>"Windows Task Manager"}>> irb(main):007:0> win.button(:name=>'Hello').exists? LoadError: Could not open library 'C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms _uia/../../../../ext/UiaDll/Release/UiaDll.dll': from C:/Ruby22/lib/ruby/gems/2.2.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:147:in `block in ffi_lib'

    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:100:in `map'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:100:in `ffi_lib'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/uia_dll.rb:116:in

<module:UiaDll>' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/uia_dll.rb:7:in module:MsUia' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/uia_dll.rb:6:in `

' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/uia_dll.rb:5:in` module:RAutomation' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/uia_dll.rb:4:in ` ' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/control.rb:59:in `exist?' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/ms_uia/button.rb:12:in ` exist?' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/button.rb:37:in`exists?' from (irb):7 from C:/Ruby22/bin/irb:11:in `
'
pradeepta02 commented 7 years ago

Solved the issue by replacing Microsoft Visual C++ 2012 Redistributable Package (x86) with Microsoft Visual C++ 2010 Redistributable Package (x86)

Thanks