边缘浏览器支持

时间:2015-12-21 19:07:12

标签: watir-webdriver

我们是否有使用watir-webdriver api对Edge浏览器的官方支持?我能够使用示例脚本启动Edge浏览器,但我无法与元素进行交互。我尝试了以下代码,但未能设置文本字段。

require 'watir-webdriver'
$browser = Watir::Browser.new 'edge'      
$browser.goto('http://www.google.com')  
$browser.text_field(:name => 'q').set "hello"

Error:
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:73:in `assert_ok': status code 501 

(Selenium::WebDriver::Error::ServerError)
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:664:in `raw_execute'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:642:in `execute'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:229:in `switchToDefaultContent'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/common/target_locator.rb:100:in `default_content'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/browser.rb:346:in `assert_exists'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:561:in `ensure_context'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:545:in `locate'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:505:in `assert_exists'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/user_editable.rb:32:in `clear'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/user_editable.rb:11:in `set'
        from test.rb:6:in `<main>'

1 个答案:

答案 0 :(得分:1)

在Selenium 2.48中,通过远程服务器使用Edge绑定(Watir所做的)与Edge有一个问题。此问题已得到修复,但在Selenium 2.49发布之前无法使用。

值得注意的是,Microsoft WebDriver for Edge仍然是一个小小的错误,所以如果你没有得到你目前得到的错误,你可能会遇到各种其他错误。 :)