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
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
Hi Dan
Thanks for the input but perhaps I have not explained my problem well enough.
I understand that you are using proxy.pac files to configure the proxy but my understaning of the proxy pac file that you included is as such. The line in that file that says:
"return 'PROXY localhost:4444; DIRECT' "
is determining when the called url has selenium-server in it somewhere
then it is passing it to the selenium proxy. Now as far as I understand of proxy.pac files is that what that line of code is saying is that pass to the selenium proxy on local host or if that doesn't work pass to direct connection.
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.
What I need to be able to do is have the browser pass to the selenium proxy (which there is no problem in doing) and then have the selenium proxy pass to the Corporate Proxy.
When I talked about the proxy handler there is a call in there newHttpTunnel which seems to be what I am looking at doing.
Any help would be appreciated.
Thanks
Blaine
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
Hi Dan
I have tried what you suggested but it seems that the problem is that for anything to get out of our intranet it must go through the corporate proxy. So if I am just to set the selenium server running and set the proxy connection in IE to localhost:4444 I can not get out to the internet at all.
I can see that the request is getting to the selenium server and that it is timing out when the request is made.
Here is the display from ther server.
C:\Temp\selenium-remote-control-0.7.1\server>java -jar selenium-server.jar -inte
ractive
May 2, 2006 10:37:57 AM org.mortbay.http.HttpServer doStart
INFO: Version Jetty/0.7.1
May 2, 2006 10:37:57 AM org.mortbay.util.Container start
INFO: Started HttpContext[/,/]
May 2, 2006 10:37:57 AM org.mortbay.util.Container start
INFO: Started HttpContext[/selenium-server,/selenium-server]
May 2, 2006 10:37:57 AM org.mortbay.util.Container start
INFO: Started HttpContext[/selenium-server/driver,/selenium-server/driver]
May 2, 2006 10:37:57 AM org.mortbay.http.SocketListener start
INFO: Started SocketListener on 0.0.0.0:4444
May 2, 2006 10:37:57 AM org.mortbay.util.Container start
INFO: Started org.mortbay.jetty.Server@4741d6
Entering interactive mode... type Selenium commands here (e.g: cmd=open&1=http:/
/www.yahoo.com)
May 2, 2006 10:38:43 AM org.openqa.selenium.server.ProxyHandler handle
WARNING: java.net.ConnectException: Connection timed out: connect
May 2, 2006 10:39:02 AM org.openqa.selenium.server.ProxyHandler handle
WARNING: java.net.ConnectException: Connection timed out: connect
May 2, 2006 10:39:03 AM org.openqa.selenium.server.ProxyHandler handle
WARNING: java.net.ConnectException: Connection timed out: connect
May 2, 2006 10:39:46 AM org.openqa.selenium.server.ProxyHandler handle
WARNING: java.net.ConnectException: Connection timed out: connect
This is where my question comes from about the proxy handler. As I see it there must be a chain from the selenium server to the corporate proxy. I need the selenium server to issue the selenese commands and I need the corporate proxy to get out to the internet.
Does this sound more reasonable.
Thanks
Blaine
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
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
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.)
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
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.