I was looking for automating windows applications and was asked to explore with rautomation, which I just started using it.
Now, after going thru’ documentation on github and Jarmo’s few blogs, I am posting a very simple problem here and I am sure I am doing something very basic wrongly.
Here is my code –
>> require "rubygems"
=> true
>> require "rautomation"
=> true
>> @window = RAutomation::Window.new :title => "System Volume (C:)"
RuntimeError: unsupported platform for RAutomation: java
from C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/adapter/helper.rb:16:in `default_adapter'
from C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/window.rb:65:in `initialize'
from (irb):10:in `new'
from (irb):10
So, question is – what am I doing wrong?
Here, I am trying to get handle on windows explorer.
Done –
Done. The problem is with Jruby usage. If I use (plain) ruby with rubymine then I don’t get any problem.
Stackoverflow won’t allow me to close my question until I have 100 reputation.
This happens because RAutomation was determining compatibility from the RUBY_PLATFORM. Next version will use OS Environment variable instead:
https://github.com/jarmo/RAutomation/commit/dd825b04aab6d90cfedf385a620095c17da92644
But, you could also use it with JRuby (it’s untested though, but it should work) right now by specifying the adapter itself so that #default_adapter method won’t be executed. You can do that in two ways:
1) Specify the adapter to the Window.new method:
2) Specify the adapter in the environment variable: