我試圖通過代理從watir webdriver訪問web。可以是HTTP或SOCKSWatir Webdriver - 更改谷歌瀏覽器上的代理
這是我的代碼到目前爲止。我發現樣品(最後3行),但它給我的錯誤:
irb
require "watir-webdriver"
browser = Watir::Browser.new :chrome
switches = '--proxy-server=88.12.44.205:3128'
browser = Watir::Browser.new :chrome, :switches => switches
browser.goto "http://ipaddresslocation.org"
Started ChromeDriver port=53928 version=18.0.1022.0 log=C:\Users\Raimis\chromedriver.log ArgumentError: :args must be an Array of Strings from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/s elenium/webdriver/chrome/bridge.rb:71:in
create_capabilities' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/s elenium/webdriver/chrome/bridge.rb:20:in
initialize' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/s elenium/webdriver/common/driver.rb:37:innew' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/s elenium/webdriver/common/driver.rb:37:in
for' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/s elenium/webdriver.rb:61:infor' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.5.3/lib/watir -webdriver/browser.rb:35:in
initialize' from (irb):6:innew' from (irb):6 from C:/Ruby193/bin/irb:12:in
'
此行給我的錯誤
browser = Watir::Browser.new :chrome, :switches => switches
關於如何解決此錯誤的任何提示?
編輯:
這裏是爲我工作的最終代碼:
irb
require "watir-webdriver"
browser = Watir::Browser.new :chrome, :switches => ['--proxy-server=88.12.44.205:3128']
browser.goto "http://ipaddresslocation.org"
謝謝!這有助於 – user1237898 2012-03-02 19:11:07