Alpha
Alpha

Reputation: 14086

How to set 'Automatic proxy configuration url' by tweaking Firefox preferences using Selenium WebDriver?

For testing an application, I've to set 'Automatic proxy configuration url' to something similar to 'http://abc.xyz.com/tester/proxy'

In order to do that, I did following:

profile = Selenium::WebDriver::Firefox::Profile.new
proxy = Selenium::WebDriver::Proxy.new(:http => "abc.xyz.com/tester/proxy")

profile.proxy = proxy
driver = Selenium::WebDriver.for :firefox, :profile => profile

But this sets 'Manual proxy Configuration' Could you please help me on how to set 'Automatic proxy configuration url'?

Upvotes: 0

Views: 2259

Answers (1)

Alpha
Alpha

Reputation: 14086

Following code sets automatic proxy configuration url:

require 'selenium-webdriver'

profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.type'] = 2
profile['network.proxy.autoconfig_url'] = "http://abc.xyz.com/tester/proxy"

driver = Selenium::WebDriver.for :firefox, :profile => profile

Upvotes: 1

Related Questions