我在Firefox中使用Watir和Selenium配置我的配置是: -
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 1
profile["network.proxy.http"] = ENV['PROXY_IP']
profile["network.proxy.ssl"] = ENV['PROXY_IP']
profile["network.proxy.http_port"] = ENV['PROXY_PORT'].to_i
profile["network.proxy.ssl_port"] = ENV['PROXY_PORT'].to_i
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
driver = Selenium::WebDriver.for :firefox, options: options
browser = Watir::Browser.new driver
browser.goto url