rautomation - 在 RubyMine 和 jRuby 中 - 出现错误
我正在寻找自动化 Windows 应用程序,并被要求探索 rautomation,我刚刚开始使用它。
现在,在浏览了 github 上的文档和 Jarmo 的几个博客之后,我在这里发布了一个非常简单的问题,我确信我做错了一些非常基本的事情。
这是我的代码 -
>> 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
所以,问题是 - 我做错了什么? 在这里,我试图掌握 Windows 资源管理器。
完毕 - 完毕。问题在于 Jruby 的使用。如果我将(普通)ruby 与 rubymine 一起使用,那么我不会遇到任何问题。 在我的声望达到 100 之前,Stackoverflow 不允许我关闭我的问题。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发生这种情况是因为 RAutomation 正在确定 RUBY_PLATFORM 的兼容性。下一个版本将使用操作系统环境变量:
https://github.com/jarmo/RAutomation/commit/dd825b04aab6d90cfedf385a620095c17da92644
但是,您也可以将它与 JRuby 一起使用(虽然它未经测试,但它应该工作)现在通过指定适配器本身,以便 #default_adapter 方法不会被执行。您可以通过两种方式执行此操作:
1) 为 Window.new 方法指定适配器:
2) 在环境变量中指定适配器:
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: