Ruby-IRB-当我使用硒3.3.0和Watir 0.9.0宝石时,Firefox立即打开和关闭

时间:2019-04-16 10:14:12

标签: ruby selenium watir

当我们使用以下命令在2秒内打开和关闭firefox时。

使用以下命令打开浏览器,并通过Watir Webdriver使用Ruby(IRB)进行自动化。

Selenium-Webdriver 3.3.0 瓦特尔-0.9.0

已检查Firefox版本-Firefox 52(ESR) Ruby版本-2.0.0-p648

已在同事系统中检查正常运行,并且配置相同。我错过了任何配置还是需要任何更改

profile = Selenium::WebDriver::Firefox::Profile.new
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: false)
@browser = Watir::Browser.new :ff,profile => profile, :desired_capabilities => capabilities```

Error Message:
irb(main):002:0> profile = Selenium::WebDriver::Firefox::Profile.new
=> #<Selenium::WebDriver::Firefox::Profile:0x3474708 @model=nil, @native_events=true, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={}, @extensions={}>
irb(main):003:0> capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: false)
=> #<Selenium::WebDriver::Remote::Capabilities:0x31ed728 @capabilities={:browser_name=>"firefox", :version=>"", latform=>:any, :javascript_enabled=>true, :css_selectors_enabled=>true, :takes_screenshot=>true, :native_events=>false, :rotatable=>false, :firefox_profile=>nil, roxy=>nil, :marionette=>false}>
irb(main):004:0> @browser = Watir::Browser.new :ff,profile => profile, :desired_capabilities => capabilities
ArgumentError: unknown option: {#<Selenium::WebDriver::Firefox::Profile:0x3474708 @model=nil, @native_events=true, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={}, @extensions={}>=>#<Selenium::WebDriver::Firefox::Profile:0x3474708 @model=nil, @native_events=true, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={}, @extensions={}>}
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/remote/bridge.rb:54:in `initialize'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/firefox/bridge.rb:46:in `initialize'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/driver.rb:54:in `new'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/driver.rb:54:in `for'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver.rb:87:in `for'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.9.0/lib/watir-webdriver/browser.rb:46:in `initialize'
        from (irb):4:in `new'
        f

0 个答案:

没有答案