【发布时间】:2014-04-24 21:12:56
【问题描述】:
尝试通过 phantomjs 驱动程序使用 JRuby 和 watir-webdriver 并获得以下异常。适用于 :chrome 和 :firefox 但使用 :phantomjs 失败。在同事的机器上也试过这个,如果失败了。可以在 JRuby 上使用 webdriver/phantomjs 吗?
详情如下:
jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.7.0-b147 [Windows 7-amd64]
watir-webdriver (0.6.9)
phantomjs -v
1.9.7
irb(main):001:0> require 'watir-webdriver'
=> true
irb(main):002:0> b = Watir::Browser.new :phantomjs
ChildProcess::Error: Unknown error (Windows says "The operation completed successfully.", but it did not.)
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess- 0.5.3/lib/childprocess/windows/lib.rb:325:in `handle_for'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/jruby.rb:48:in `windows_handle_for'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/windows/lib.rb:306:in `handle_for'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/windows/process_builder.rb:137:in `std_stream_hadle_for'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/windows/process_builder.rb:109:in `setup_io'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/windows/process_builder.rb:32:in `start'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/windows/process.rb:68:in `launch_process'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/childprocess-0.5.3/lib/childprocess/abstract_process.rb:82:in `start'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/phantomjs/service.rb:42:in `start'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/phantomjs/bridge.rb:20:in `initialie'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/common/driver.rb:45:in `for'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver.rb:67:in `for'
from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/watir-webdriver-0.6.9/lib/watir-webdriver/browser.rb:46:in `initialize'
from (irb):2:in `evaluate'
from org/jruby/RubyKernel.java:1101:in `eval'
from org/jruby/RubyKernel.java:1501:in `loop'
from org/jruby/RubyKernel.java:1264:in `catch'
from org/jruby/RubyKernel.java:1264:in `catch'
from C:/jruby-1.7.12/bin/jirb:13:in `(root)'
【问题讨论】:
-
这也是在 Windows 7 上
-
你下载了 phantomjs 并把它放在了路径上的某个地方吗?
-
实际上在仔细检查堆栈跟踪时,看起来 webdriver 正在使用子进程 gem,这是由于某种原因而窒息的原因
标签: selenium-webdriver phantomjs jruby watir-webdriver child-process