How do I route watir through a proxy pragmatically?
Posted
by feydr
on Stack Overflow
See other posts from Stack Overflow
or by feydr
Published on 2010-06-04T00:38:06Z
Indexed on
2010/06/10
22:23 UTC
Read the original article
Hit count: 292
I'm trying to route watir through a proxy pragmatically -- this means within the script I'd like to change my proxy dynamically before launching the browser.
Here's what I've tried so far (and so far am failing): I'm running chrome and lucid lynx ubuntu. I chose TREX cause I thought watir might be making use of PROXY or something.
I rewrote /usr/bin/google-chrome as:
#!/bin/bash
/opt/google/chrome/chrome --proxy-server="$TREX" $@
The reason I'm passing in the environment variable to proxy-server rather than http_proxy is because I never could get http_proxy to work as is anyways
then I did a simple:
require 'rubygems'
require 'watir-webdriver'
ENV['TREX'] = "XX.XX.XX.XX:YY"
browser = Watir::Browser.new(:chrome)
browser.goto("http://mysite.com")
Anyways, what is happening here is that it is forwarding me to the login page of the proxy rather than just forwarding the request.
What am I missing here? I feel like I'm pretty close.
© Stack Overflow or respective owner