ruby watir classic won't authenticate proxy

362 Views Asked by At

I try to open internet explorer via watir-webdriver with my code:

require "watir-webdriver"


profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new :http => 'http://username:[email protected]:xxxxx', :ssl => 'http://username:[email protected]:xxxxx'

And I get this error stating something about the I'm guessing? This is what it reads:

C:/Ruby/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/profile.rb:205:in `Integer': invalid value for Integer(): "//username:[email protected]:xxxxx" (ArgumentError)
    from C:/Ruby/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/profile.rb:205:in `set_manual_proxy_preference'
    from C:/Ruby/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/profile.rb:176:in `proxy='
    from test1.rb:6:in `<main>'
1

There are 1 best solutions below

0
On

I can explain the error at least. You can't pass in basic authentication to a proxy url because the code expects that a colon in the string is distinguishing a host from a port (which needs to be an integer.

I do not have much experience with using proxies with Selenium. Poking around on the internet for the problem give suggestions such as setting signon.autologin.proxy to true in your designated Firefox profile, or adding the Firefox autoauth extension. Essentially you can save your password once manually in your profile, and then automated tests won't have to input it.