2015-12-21 282 views
1

任何想法,如果我們有使用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

'任何想法,如果我們有正式支持Edge瀏覽器使用watir-webdriver api.' - 這似乎更像是watir開發人員的支持問題。這可能會更好,因爲這只是一個問題,爲什麼你的代碼在Edge中不工作。 – BSMP

回答

1

在硒2.48,存在經由遠程服務器使用Ruby的綁定(它的Watir確實)與邊緣的問題。此問題已得到解決,但在Selenium 2.49發佈之前無法使用。

還值得一提的是,Microsoft WebDriver for Edge仍然有點小錯誤,所以如果您沒有收到目前收到的錯誤,您可能會收到各種其他錯誤。 :)

+0

感謝您的信息。 – skp24