9 Replies Last post: Jul 17, 2008 4:58 AM by Jayaprakash  
blaine stearns Beginner 3 posts since
May 1, 2006
Currently Being Moderated

May 1, 2006 4:51 PM

Proxy Chaining

I am trying to run the selenium server on our intranet but I am running into trouble where I can pass the request to the selenium server with no problem but to get out of our intranet to the internet I need to pass through our corporate proxy.  Thus I need to be able to tell the selenium proxy that it needs to talk to the corporate proxy.  I have read through all the stuff in the forums and no one seems to have run into this yet.

 

I have looked at the selenium server and the proxy handler and it seems that the proxy handler can create the tunnel but the selenium server does not seem to be able to use this.

 

Is it possible?

 

Blaine

Dan Fabulich Almighty 919 posts since
Dec 8, 2005
Currently Being Moderated
1. May 1, 2006 8:48 PM in response to: blaine stearns
Re: [selenium-rc-users] Proxy Chaining

blaine stearns wrote:

 

I am trying to run the selenium server on our intranet but I am running

into trouble where I can pass the request to the selenium server with no

problem but to get out of our intranet to the internet I need to pass

through our corporate proxy.  Thus I need to be able to tell the

selenium proxy that it needs to talk to the corporate proxy.  I have

read through all the stuff in the forums and no one seems to have run

into this yet.

 

I suspect you may be looking in the wrong place for this.  We're using

proxy.pac files in order to configure our proxy.

 

http://nscsysop.hypermart.net/proxypac.html

 

Here's an example proxy.pac:

 

function FindProxyForURL(url, host) {

    if(shExpMatch(url, '/selenium-server/')) {

        return 'PROXY localhost:4444; DIRECT'

    }

}

 

In other words, the browser will automatically send requests containing

"/selenium-server/" to the proxy, but all other requests are unproxied and

go DIRECT.

 

Is it possible?

 

Sure.  Just configure your browser's proxy settings manually and don't use

"firefox" or "iexplore"... instead, just use the path to your browser as

if it were an unsupported browser.

 

http://www.openqa.org/selenium-rc/tutorial.html#otherbrowsers

 

So in that case, you'd launch Firefox like this, with no *firefox:

 

cmd=getNewBrowserSession&1=c:\program files\mozilla firefox\firefox.exe&2=http://www.google.com

 

-Dan

 


To unsubscribe, e-mail: selenium-rc-users-unsubscribe@openqa.org

For additional commands, e-mail: selenium-rc-users-help@openqa.org

 

 

 

Dan Fabulich Almighty 919 posts since
Dec 8, 2005
Currently Being Moderated
3. May 2, 2006 11:09 AM in response to: blaine stearns
Re: [selenium-rc-users] Re: Proxy Chaining

blaine stearns wrote:

 

At first I thought that if I just edited the proxy.pac file and changed

that line to something like: "return 'PROXY localhost:4444; Proxy

CorporateProxy'" that it would chain the two proxies, but that is not

the case.  It passes to the selenium proxy and that is it.  So it seems

that the line works as a XOR.

 

Nope, you've misread the file.  What you want is something more like this:

 

function FindProxyForURL(url, host) {

    if(shExpMatch(url, '/selenium-server/')) {

        return 'PROXY localhost:4444; DIRECT'

    } else {

        return 'PROXY CorporateProxy';

    }

}

 

That is, the important part here isn't the "; DIRECT" bit, it's the fact

that this proxy.pac is a traffic controller: if the URL contains

"/selenium-server/" then it needs to go through our proxy; otherwise it

needs to go through yours.  The "; DIRECT" bit just provides a fallback

for when localhost:4444 is down.

 

I assure you, the change doesn't happen in ProxyHandler; that would only

be useful/needed if you were using our proxy for everything, which you're

not...  You're only using it to access URLs containing

"/selenium-server/".  For everything else, your browser is taking care of

the requests by itself without any intervention from the Selenium Server.

 

-Dan

 


To unsubscribe, e-mail: selenium-rc-users-unsubscribe@openqa.org

For additional commands, e-mail: selenium-rc-users-help@openqa.org

 

 

 

melb Beginner 29 posts since
Jan 17, 2007
Currently Being Moderated
5. Feb 5, 2007 8:51 AM in response to: blaine stearns
Re: Proxy Chaining

Hi Blaine!

 

Have you found a solution for your problem?

I think I have the same problem. My testApp runs on a nonproxy Host, but my Images come from a proxied host. So I need a possibiliy to tell the Selenium Server, for a special Host do NOT use the proxy.

Are my thoughts right?

 

Thanks in advance!

Melanie

Nelson Sproul Expert 405 posts since
Jan 3, 2006
Currently Being Moderated
6. Apr 2, 2008 2:07 AM in response to: blaine stearns
Re: Proxy Chaining

You can ask the selenium server to route requests through a firewall proxy by setting the Java properties http.proxyHost and http.proxyPort.  For example, to arrange for the selenium server to forward requests to the proxy server some_proxy_host, listening on port 2501, you would start the selenium server as follows:

 

java -jar selenium-server.jar -interactive -Dhttp.proxyHost=some_proxy_host -Dhttp.proxyPort=2501

Nelson Sproul Expert 405 posts since
Jan 3, 2006
Currently Being Moderated
7. Apr 2, 2008 2:15 AM in response to: melb
Re: Proxy Chaining

You can ask the selenium server to refrain from proxying requests for a particular host or hosts by setting the http.nonProxyHosts Java property.  For example, to avoid proxying requests from image.server1 and image.server2, you would start the selenium server as follows:

 

java -jar selenium-server.jar -interactive '-Dhttp.nonProxyHosts=image.server1|image.server2'

 

(Note the quotes to prevent the shell from interpreting the pipe.)

Beginner 1 posts since
Apr 23, 2008
Currently Being Moderated
8. Apr 23, 2008 5:39 PM in response to: blaine stearns
Re: Proxy Chaining

Hi Blaine/others,

 

You can do this using the -avoidProxy option (in combination with -Dhttp.proxyHost and -Dhttp.proxyPort) so that requests to anything other than /selenium-server/* go straight to your (other) proxy.  A bit roundabout, but solves the problem for most of us.

 

Full writeup on my blog at http://willbryant.net/software/2008/04/24/selenium_rc_proxy_chaining.

 

Cheers,

Will

Jayaprakash Beginner 26 posts since
Jul 8, 2008
Currently Being Moderated
9. Jul 17, 2008 4:58 AM in response to: blaine stearns
Re: Proxy Chaining

With a client driver, only the following works for me

 

File : /Applications/Firefox.app/Contents/MacOS/defaults/pref/firefox.js

 

pref("network.proxy.share_proxy_settings",  false); // use the same proxy settings for all protocols
pref("network.proxy.type", 1);
pref("network.proxy.ftp", "myproxy.mydomain.com");
pref("network.proxy.ftp_port", 3333);
pref("network.proxy.gopher", "myproxy.mydomain.com");
pref("network.proxy.gopher_port", 3333);
pref("network.proxy.http", "myproxy.mydomain.com");
pref("network.proxy.http_port", 3333);
pref("network.proxy.ssl", "myproxy.mydomain.com");
pref("network.proxy.ssl_port", 3333);
pref("network.proxy.socks", "myproxy.mydomain.com");
pref("network.proxy.socks_port", 3333);
pref("network.proxy.socks_version", 5);
pref("network.proxy.socks_remote_dns", false);
pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");

 


Thanks to one of forum posts by someone called Kavitha.

More Like This

  • Retrieving data ...