Setting Http Proxy when using the selenium-webdriver gem and Firefox
source link: https://blog.chrislowis.co.uk/2010/07/14/http-proxy-selenium-webdriver-and-firefox.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Setting Http Proxy when using the selenium-webdriver gem and Firefox
July 14, 2010
I've been using the selenium-webdriver ruby gem to do some automated Cucumber testing of our application. Sadly, I'm sat behind a firewall which requires an HTTP proxy to access the outside world. Using the Chrome WebDriver bridge worked fine as it inherits the system preferences on OS X. However with Firefox I had to perform some trickery to get it to work:
require 'rubygems' require 'selenium-webdriver' include Selenium profile = WebDriver::Firefox::Profile.new profile["network.proxy.type"] = 1 profile["network.proxy.http"] = "www-cache.at.my.work.co.uk" profile["network.proxy.http_port"] = 80 driver = WebDriver.for(:firefox, :profile => profile) driver.navigate.to "http://google.com"
The []=
method on Profile
is setting the options that you find by
typing 'about:config' in the Firefox URL bar. Take a look there in a
working Firefox profile to see what variables you should set for your
webdriver-specific profile in the code above.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK