watirgrid 和 sikuli - 他们可以一起玩吗?
我想知道 watirgrid / gridinit 是否可以与 Sikuli 结合使用。 http://www.sikuli.org
我已经成功地将 Sikuli 与 watir-webdriver 和 cucumber 集成在一起,如下所示 中的示例
这一切都是由 Jruby 完成的。
我的下一步是看看是否可以使用 watirgrid 发送 sikuli 命令,但到目前为止我还没有成功。
我按照 http://altentee.com/blogs/2010 中的示例进行操作/watirgrid-support-for-watir-webdriver/
我输入的内容:
irb
require 'watirgrid'
require 'watir-webdriver'
require 'java'
java_import "org.sikuli.script.SikuliScript"
java_import "org.sikuli.script.Region"
java_import "org.sikuli.script.Screen"
# setup a controller on port 12351 for your new grid
controller = Controller.new(
:ring_server_port => 12351,
:loglevel => Logger::ERROR)
controller.start
# add a provider to your grid
# :browser_type => 'webdriver' if using webdriver or
# :browser_type => 'ie' if using watir...
provider = Provider.new(
:ring_server_port => 12351,
:loglevel => Logger::ERROR, :browser_type => 'webdriver')
provider.start
# connect to the grid and take all providers from it (this time only one)
grid = Watir::Grid.new(:ring_server_port => 12351, :ring_server_host => '192.168.0.107')
screen=Screen.new
grid.start(:take_all => true)
+++++++++++++ 到目前为止一切都很好。 ++++++++++++++
+++++++++++++ 这是轮子脱落的地方 ++++++++++++++++
++ +++++++++++ 如何获取 watirgrid 可用的 screen 方法? ++++++++++++++
irb(main):029:0* grid.screen.click("StartUpAdobe\/f.png",0)
NoMethodError: undefined method `screen' for #<Watir::Grid:0x1a0283e>
from (irb):29:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:70:in `start'
from C:\jruby-1.6.2\bin\irb:13:in `(root)'
我们有兴趣使用 watigrid 和 sikuli 来测试基于 vnc 的应用程序的性能。
I was wondering if watirgrid / gridinit could be used in conjunction with Sikuli. http://www.sikuli.org
I've had some success integrating Sikuli with watir-webdriver and cucumber following the examples in
It's all being done from Jruby.
The next step for me was to see if I could use watirgrid to send sikuli commands, but I haven't had success thus far.
I followed the example in http://altentee.com/blogs/2010/watirgrid-support-for-watir-webdriver/
what I entered:
irb
require 'watirgrid'
require 'watir-webdriver'
require 'java'
java_import "org.sikuli.script.SikuliScript"
java_import "org.sikuli.script.Region"
java_import "org.sikuli.script.Screen"
# setup a controller on port 12351 for your new grid
controller = Controller.new(
:ring_server_port => 12351,
:loglevel => Logger::ERROR)
controller.start
# add a provider to your grid
# :browser_type => 'webdriver' if using webdriver or
# :browser_type => 'ie' if using watir...
provider = Provider.new(
:ring_server_port => 12351,
:loglevel => Logger::ERROR, :browser_type => 'webdriver')
provider.start
# connect to the grid and take all providers from it (this time only one)
grid = Watir::Grid.new(:ring_server_port => 12351, :ring_server_host => '192.168.0.107')
screen=Screen.new
grid.start(:take_all => true)
+++++++++++++ all is fine up to this point. ++++++++++++++
+++++++++++++ this is where the wheels come off ++++++++++++++
+++++++++++++ how to get the screen method available to watirgrid ? ++++++++++++++
irb(main):029:0* grid.screen.click("StartUpAdobe\/f.png",0)
NoMethodError: undefined method `screen' for #<Watir::Grid:0x1a0283e>
from (irb):29:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from C:/jruby-1.6.2/lib/ruby/1.8/irb.rb:70:in `start'
from C:\jruby-1.6.2\bin\irb:13:in `(root)'
We're interested in using watigrid and sikuli for performance testing a vnc-based application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,在您的代码中,调用 .screen 并不存在于“grid”对象上,它实际上是属于 Screen 类的方法,我猜它是 sikuli 包的一部分。
从示例来看,Screen 类对象是在本地实例化的。您想要的是远程实例化该对象。
Watirgrid 只是通过 DRb 公开远程 watir[-webdriver] 对象。它不了解 Sikuli。在示例中,您似乎只是使用 watir-webdriver 启动浏览器实例并导航到首页。从那时起,我猜 Sikuli 承担了大部分工作。
你真正需要的是 Sikuligrid =) 因为你是唯一被问到的人,所以我不打算去猴子补丁 Watirgrid,因为可能有更好的方法来实现你想要做的事情。
使用 DRb,您甚至可以做一些非常简单的事情,如下所示:
remote.rb
local.rb
此时,我对 watirgrid 的关注点是启用 watir[- webdriver]在分布式网格网络上。不过,我确实承认像 webdriver 这样的东西在驱动网络应用程序之外的“其他”东西方面很有用。这就是 Sikuli 甚至 nativedriver 等工具 http://code.google.com/p/nativedriver/< /a> 看起来很有吸引力。现在虽然我的重点是让 watirgrid 防弹,但列表中的下一个可能是使用 phantomjs 的无头浏览器自动化......
So in your code, calling .screen does not exist on the 'grid' object, it is actually a method that belongs to the Screen class, which is part of the sikuli packages I'm guessing.
It looks like from the examples, the Screen class object is instantiated locally. What you want is for this object to be instantiated remotely.
Watirgrid just exposes remote watir[-webdriver] objects via DRb. It has no knowledge of Sikuli. It looks like in the examples, you're just using watir-webdriver to start an instance of the browser and navigate to the front page. From then on I'm guessing Sikuli does most of the work.
What you really need is a Sikuligrid =) Since you're the only person that's asked I'm not about to go monkey patch Watirgrid, as there might be a better way to achieve what you're trying to do.
Using DRb you may even be able to do something very simple like this:
remote.rb
local.rb
At this point my focus with watirgrid is to enable testing of watir[-webdriver] on a distributed grid network. I do however acknowledge the usefulness of things like webdriver in driving something 'other' than a web app. This is where tools like Sikuli and even nativedriver http://code.google.com/p/nativedriver/ are looking very attractive. Right now though my focus is on making watirgrid bulletproof and probably next on the list is headless browser automation with phantomjs...
正如 Tim 所发布的,在有人构建“Sikuli 网格”之前,您最好的选择是按照 Tim 的建议创建自己的此类网格。
我的博客文章中介绍了另一个更简单但仍有开发工作要做的替代方案。这是一种尚未实施和验证的理论方法。
http://autumnator. wordpress.com/2011/12/22/autoit-sikuli-and-other-tools-with-selenium-grid/
As Tim posted, until someone builds a "Sikuli Grid", your best option is to create your own such Grid following Tim's suggestions.
Another simpler but yet still has development work to do alternative is presented in my blog post. It's a theoretical approach that has yet to be implemented and proven though.
http://autumnator.wordpress.com/2011/12/22/autoit-sikuli-and-other-tools-with-selenium-grid/