0

In automation, I'm trying to handle windows popup using rautomation. I've following gems installed:

ffi (1.9.0 x86-mingw32, 1.8.1 x86-mingw32)
rautomation (0.9.2)

I tried following:

require 'rautomation'
window = RAutomation::Window.new :title => "Opening rautomation-0.9.2.gem"

=> #<RAutomation::Window:0x2c4bd30 @adapter=:win_32, @window=#<RAutomation::Adapter::Win32::Window:0x2ccd7c8 @container=#<RAutomation::Windo
w:0x2c4bd30 ...>, @locators={:index=>0, :title=>"Opening rautomation-0.9.2.gem"}>>

By default, adapter isn't set to ffi (It's set to win_32, I'm using windows machine) and hence I tried to set it to ffi:

window.hwnd
=> 1508532
new_window = RAutomation::Window.new :hwnd => 1508532, :adapter => :ffi

But it's resulting into following error:

NameError: uninitialized constant RAutomation::Adapter::Ffi
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.9.2/lib/rautomation/window.rb:67:in `const_get'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.9.2/lib/rautomation/window.rb:67:in `initialize'
        from (irb):7:in `new'
        from (irb):7
        from C:/Ruby193/bin/irb:12:in `<main>'

Following are my questions:

  1. Why adapter isn't set to ffi even though ffi installed on my machine?
  2. How to resolve the error that I faced when I tried to set adapter to ffi? (For this I had also done: set RAUTOMATION_ADAPTER=ffi still it's not working)
Cœur
  • 37,241
  • 25
  • 195
  • 267
Alpha
  • 13,320
  • 27
  • 96
  • 163

1 Answers1

1

The problem here is that :win_32 is newer name for :ffi adapter. In other words, you are already using the correct adapter and that's why you cannot set it to use :ffi adapter anymore, since that does not exist by that name.

Why do you want to set it to :ffi in the first place? Is there some outdated documentation from where you got the idea to do that?

Jarmo Pertman
  • 1,905
  • 1
  • 12
  • 19
  • I wasn't aware that :win32 and :ffi are same. Thanks Jarmo Pertman for informing. For handling popups I was referring http://itreallymatters.net/post/2352350743/automating-windows-and-their-controls-with-ruby#.UezRWI0wdWU and I found there only two adapters- ffi and autoit and hence I thought I should change it to ffi. Actually, I was facing another problem which made me to ask this question. The problem has been asked at http://stackoverflow.com/questions/17782546/unable-to-find-buttons-of-system-popup-using-rautomation Please help me to solve that. – Alpha Jul 22 '13 at 08:01
  • Oh, right. That post is really old indeed. Not sure i can update all the history in the world :D Sorry for causing any confusions. You can mark this as an accepted answer then. – Jarmo Pertman Jul 22 '13 at 17:40