Q:

Watir with webdriver, proxy, Firefox

I am able to use watir-webdriver with IE, but I would prefer to use Firefox.
Problem: I need a proxy.
By googling around, I found some code snippets, but I am not able to put all them together.
This is what I produced up to now, please let me know what am I missing:
require 'watir-webdriver'

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.http", "proxy.myplace.com");
profile.setPreference("network.proxy.http_port", 8080);
WebDriver driver = new FirefoxDriver(profile);

browser = Watir::Browser.new :firefox
browser.goto( "http://www.google.com/" )

I get this error message:
I:/watir/webdriver/webdrivertest.rb:3: syntax error, unexpected tCONSTANT, expec
ting keyword_do or '{' or '('
FirefoxProfile profile = new FirefoxProfile();

Also, I don't know how to use the variable called 'driver'

A:

Call the underlying Selenium WebDriver.
I've used this technique to set a path to Firefox 3.6 so I can test with both Firefox 4 and 3.6:
Selenium::WebDriver::Firefox.path = ENV['FIREWATIRPATH']
browser = Watir::Browser.new :firefox

So to do what you're trying to do:
profile = Selenium::WebDriver::Firefox::Profile.new
proxy = Selenium::WebDriver::Proxy.new(:http => "http://proxy.org:8080")
profile.proxy = proxy

# You have to do a little more to use the specific profile
driver = Selenium::WebDriver.for :firefox, :profile => profile
browser = Watir::Browser.new(driver)

Look at: Selenium Ruby Bindings and Webdriver FAQ for more info.

What problem are you having with the Proxy line?
You could try this:
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 1
profile["network.proxy.http"] = "proxy.myplace.com"
profile["network.proxy.http_port"] = 8080

The idea is to see what your settings are in about:config and duplicating them in code.

A:

profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new :http => '12.12.12.12:8888', :ssl => '15.15.15.15:443'
browser = Watir::Browser.new :firefox, :profile => profile

