想請教各位先進一個在使用 Watir-webdriver 時會遇到的問題
環境如下:Mac 10.7.5 與 Ubuntu 12.04 Ruby 版本 : 1.9.2-p320 安裝 Ruby 方式:皆同樣是採 RVM 安裝,且獨立用 gemset
安裝的 gem :
addressable (2.3.2) bundler (1.2.1) childprocess (0.3.5) ffi (1.1.5) headless (0.3.1) libwebsocket (0.1.5) multi_json (1.3.6) nokogiri (1.5.5) rake (0.9.2.2) rb-readline (0.4.2) rubygems-bundler (1.1.0) rubyzip (0.9.9) rvm (1.11.3.5) selenium-webdriver (2.25.0) watir-webdriver (0.6.1)
code 都按照http://watirwebdriver.com/ 所述
require 'watir-webdriver' b = Watir::Browser.new b.goto 'bit.ly/watir-webdriver-demo' b.text_field(:id => 'entry_0').set 'your name' b.select_list(:id => 'entry_1').select 'Ruby' b.select_list(:id => 'entry_1').selected? 'Ruby' b.button(:name => 'submit').click b.text.include? 'Thank you'
但是在 Mac 下就可以正常開啟 Firefox, 但在 Ubuntu 12.04 就會報錯
錯誤訊息如下:
/home/user/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/uri/common.rb:126:in split': bad URI(absolute but no path): http:// (URI::InvalidURIError)
from /home/user/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/uri/common.rb:174:in
parse'
from /home/user/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/uri/common.rb:628:in parse'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:91:in
new_http_client'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:16:in http'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in
response_for'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in request'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in
call'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in raw_execute'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:92:in
create_session'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:68:in initialize'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/firefox/bridge.rb:32:in
initialize'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:31:in new'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:31:in
for'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver.rb:65:in for'
from /home/user/.rvm/gems/ruby-1.9.2-p320@watir/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:35:in
initialize'
from test.rb:7:in new'
from test.rb:7:in
基本上在 b = Watir::Browser.new , 這一行執行時就會產生錯誤, 但同樣的 code 在 Mac 就沒有什麼問題,甚至在 WIndows 也沒有什麼問題, 所以想請教各位先進是否有什麼解決的方法,感謝