How to run selenium chrome nodes using proxy?

493 views
Skip to first unread message

Sushan Ghimire

unread,
Mar 8, 2015, 10:59:01 PM3/8/15
to seleniu...@googlegroups.com

My original question is here. I'm using Selenium version 2.44.0.

1. About node image's config.json

I'm using Docker Selenium images to run browser nodes, repo is available here: https://github.com/SeleniumHQ/docker-selenium. There is no documentation on how config.json can be used to provide proxy values.

In my infrastructure, there are certain assets that are sourced from a location which needs proxy configuration to access them. I'm trying to setup proxy on a chrome node. According to this documentation here, proxy can be set like following:

java -jar selenium-2.44.0.jar -Dhttp.proxyHost=192.168.2.10 -Dhttp.proxyPort=80

My proxy does not require usename and password hence I have ignored those values. What is not clearly mentioned on SeleniumHQ documentation is, whether it needs proxy configuration on both hub or nodes or just the nodes. I've tried different combinations but hasn't worked for me.

Actual commands i'm running are:

For Hub:

java -jar /opt/selenium/selenium-server-standalone.jar -role hub -Dhttp.proxyHost=192.168.2.10 -Dhttp.proxyPort=80 -hubConfig /opt/selenium/hubconfig.json

When I run command above, I can see -D* values being displayed on console config.

For node:

xvfb-run --server-args=":99.0 -screen 0 1360x1020x24 -ac +extension RANDR" java -jar /opt/selenium/selenium-server-standalone.jar -Dhttp.proxyHost=192.168.2.10 -Dhttp.proxyPort=80  -role node -hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register -nodeConfig /opt/selenium/config.json

When I run this command I can see the proxy values on console again but I the assets are not loaded by the browser.

Also, on a side note it seems like this can be done on developers side (in java code) but I'm keen to solve it on my (operations) side.

Krishnan Mahadevan

unread,
Mar 10, 2015, 3:54:36 AM3/10/15
to Selenium Users
Sushan,

The proxy settings that you apply at the JVM level using -Dhttp.proxyHost I believe is applicable ONLY to the JVm and perhaps not applicable to the child processes that are spun off by the JVM [ Remember the node is responsible for spawning the browsers as a separate child process ]

What you actually need to be able to pass the proxy settings that are to be applied at the browser level via the capabilities. This would ofcourse require code changes. But since you are keen on solving this from the operations side, have you tried experimenting with setting up a proxy at the system level ?
That way any browser instance that gets spawned will automatically inherit the system level proxy settings and thus should work for you.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6848b9bb-b13f-4255-b1c7-4c9ad5395bc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages