1

I'm looking to use Selenium with a username/password authenticated proxy in Ruby. I realize that most people use ProxyChain when doing this in Chrome, but I'd like to use a solution without any additional gems since it doesn't play well on Heroku, plus I'm using Firefox so there seems to be a possible other option judging by THIS question though it's written in Python.

I used the selenium docs to translate that code to Ruby, but Selenium is still not using my proxy when navigating to a webpage. Oddly enough when I refresh the page manually it prompts me for the username/password but it doesn't do that on the initial page load.

profile = Selenium::WebDriver::Firefox::Profile.new

profile["network.proxy.type"] = 1
# proxy ip and port are fake for this example
profile["network.proxy.http"] = "182.192.157.60"
profile["network.proxy.http_port"] = 12345

# set the username and password
profile["network.proxy.socks_username"] = "my_username"
profile["network.proxy.socks_password"] = "my_password"

options = Selenium::WebDriver::Firefox::Options.new(profile: profile)

driver = Selenium::WebDriver.for :firefox, options: options

If anyone has any ideas I would certainly appreciate the help. Thank you.

Dave
  • 11
  • 2
  • Just wanted to introduce you WATIR. This is a wrapper around ruby selenium binding. If you just move to watir code and raise a question by tagging WATIR, you may get reply soon. – Rajagopalan Jan 08 '22 at 05:31
  • 2
    @Rajagopalan WAITR's github repo says "this is a Selenium issue" https://github.com/watir/watir/issues/798. Do you know that there's a way to accomplish using an authenticated proxy with WAITR? – Dave Jan 09 '22 at 01:02
  • I never used Proxy. – Rajagopalan Jan 09 '22 at 04:25

0 Answers0