New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium Docker NodeChrome proxy isssue #42

Closed
sushanco opened this Issue Feb 16, 2015 · 8 comments

Comments

Projects
6 participants
@sushanco

sushanco commented Feb 16, 2015

I've setup selenium grid in a private network which requires use of proxy box to access development pages, therefore I'm having to add proxy configurations to selenium docker chrome nodes.

I had a look at docker-selenium/NodeChrome/config.json (below), there isn't a key to add IP/Hostname but port is there, bit strange this. Are test team supposed to have proxy configured in test suites? Even then there should be a way to configure proxy in browser nodes. Am I missing something?

"configuration": {
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 1,
"port": 5555,
"register": true,
"registerCycle": 5000
}

@sushanco sushanco changed the title from NodeChrome proxy isssue to Selenium Docker NodeChrome proxy isssue Feb 16, 2015

@rubytester

This comment has been minimized.

Show comment
Hide comment
@rubytester

rubytester Jun 9, 2015

Contributor

Could you add an example of how you need to use it? I usually add a proxy to browser sessions I start. Maybe I am not understanding this issue. example would help

Contributor

rubytester commented Jun 9, 2015

Could you add an example of how you need to use it? I usually add a proxy to browser sessions I start. Maybe I am not understanding this issue. example would help

@cristian-smocot

This comment has been minimized.

Show comment
Hide comment
@cristian-smocot

cristian-smocot Jun 19, 2015

When you create the docker container, you should set the environment variables http_proxy, https_proxy.
That way no need to pass any proxy configuration to Chrome, it should use the environment variables.

I use Javascript (node.js) and the library dockerode to create and start my containers.
So I always set the proxies as environment variables in Javascript, when creating the container.

You could create the container manually with docker create.
This command accepts a parameter --env[] where you could set the proxy information.
Investigate more with: docker create --help

Another options could be to create another Docker image, and in the Dockerfile, set the proxies as environment variables.
Something like this:

FROM selenium/node-chrome:latest

MAINTAINER Your-Email-HERE

#set proxy information to environment
ENV http_proxy=http://user:password@proxy.corp:8080 \
    https_proxy=http://user:password@proxy.corp:8080 \
    HTTP_PROXY=http://user:password@proxy.corp:8080 \
    HTTPS_PROXY=http://user:password@proxy.corp:8080

Hope this helps people that might not know how to set the proxy information.

cristian-smocot commented Jun 19, 2015

When you create the docker container, you should set the environment variables http_proxy, https_proxy.
That way no need to pass any proxy configuration to Chrome, it should use the environment variables.

I use Javascript (node.js) and the library dockerode to create and start my containers.
So I always set the proxies as environment variables in Javascript, when creating the container.

You could create the container manually with docker create.
This command accepts a parameter --env[] where you could set the proxy information.
Investigate more with: docker create --help

Another options could be to create another Docker image, and in the Dockerfile, set the proxies as environment variables.
Something like this:

FROM selenium/node-chrome:latest

MAINTAINER Your-Email-HERE

#set proxy information to environment
ENV http_proxy=http://user:password@proxy.corp:8080 \
    https_proxy=http://user:password@proxy.corp:8080 \
    HTTP_PROXY=http://user:password@proxy.corp:8080 \
    HTTPS_PROXY=http://user:password@proxy.corp:8080

Hope this helps people that might not know how to set the proxy information.

@sushanco

This comment has been minimized.

Show comment
Hide comment
@sushanco

sushanco Jun 21, 2015

@cristian-smocot I spent quite a lot of time trying to use environment variables on VM and application level. Chrome doesn't pick up http_proxy environment variable. Also till now doesn't have way to pick up environment variables as such (uses --proxy-server but doesn't take credentials), take a look at this url.

https://www.chromium.org/developers/design-documents/network-settings

Considering time I had to spend on it, I had two options either to create browser profiles (which is against automation & also not very maintainable) or to white-list certain requests. I went for the latter one.

sushanco commented Jun 21, 2015

@cristian-smocot I spent quite a lot of time trying to use environment variables on VM and application level. Chrome doesn't pick up http_proxy environment variable. Also till now doesn't have way to pick up environment variables as such (uses --proxy-server but doesn't take credentials), take a look at this url.

https://www.chromium.org/developers/design-documents/network-settings

Considering time I had to spend on it, I had two options either to create browser profiles (which is against automation & also not very maintainable) or to white-list certain requests. I went for the latter one.

@cristian-smocot

This comment has been minimized.

Show comment
Hide comment
@cristian-smocot

cristian-smocot Jun 22, 2015

I'm using boot2docker v.1.6.1 on Windows, with docker v.1.61.

And in my case Crome picks up the proxy information from the system environment variables.
The image I use, is selenium/node-chrome:latest (as of 22/06/2015 latest = v.2.46.0).

cristian-smocot commented Jun 22, 2015

I'm using boot2docker v.1.6.1 on Windows, with docker v.1.61.

And in my case Crome picks up the proxy information from the system environment variables.
The image I use, is selenium/node-chrome:latest (as of 22/06/2015 latest = v.2.46.0).

@cristian-smocot

This comment has been minimized.

Show comment
Hide comment
@cristian-smocot

cristian-smocot Jul 19, 2015

I take back my previous comments.
In Docker v.1.7.1 it doesn't work anymore.
Some changes or what not, I do not know, in Docker or in this Chrome Node, made Chrome browser not read the environment variables.

To see how I fixed this Chrome proxy issue, see my answer to my own issue here #78 (comment)

cristian-smocot commented Jul 19, 2015

I take back my previous comments.
In Docker v.1.7.1 it doesn't work anymore.
Some changes or what not, I do not know, in Docker or in this Chrome Node, made Chrome browser not read the environment variables.

To see how I fixed this Chrome proxy issue, see my answer to my own issue here #78 (comment)

@alexellis

This comment has been minimized.

Show comment
Hide comment
@alexellis

alexellis Nov 3, 2015

+1 for ENV http_proxy - this works for a non-authenticating proxy.

alexellis commented Nov 3, 2015

+1 for ENV http_proxy - this works for a non-authenticating proxy.

@ashutoshmittal2309

This comment has been minimized.

Show comment
Hide comment
@ashutoshmittal2309

ashutoshmittal2309 Dec 14, 2016

I was having same exact issue and was able to resolve by using below script -

https://github.com/sjitech/proxy-login-automator

This can be inserted as part of your docker setup where the browser is running. After that, the selenium Desired Capabilities or protractor config file has to point to this proxy which authenticates with actual proxy.

ashutoshmittal2309 commented Dec 14, 2016

I was having same exact issue and was able to resolve by using below script -

https://github.com/sjitech/proxy-login-automator

This can be inserted as part of your docker setup where the browser is running. After that, the selenium Desired Capabilities or protractor config file has to point to this proxy which authenticates with actual proxy.

@diemol

This comment has been minimized.

Show comment
Hide comment
@diemol

diemol Sep 7, 2017

Member

This can be done today by either rebuilding the image following these instructions, or just by passing the http_proxy as an env var when doing docker run.

Please note that the configuration value "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", has a complete different purpose, which is to allow the possibility of overwriting the node's behaviour when handling sessions, not related at all to http proxies.

Member

diemol commented Sep 7, 2017

This can be done today by either rebuilding the image following these instructions, or just by passing the http_proxy as an env var when doing docker run.

Please note that the configuration value "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", has a complete different purpose, which is to allow the possibility of overwriting the node's behaviour when handling sessions, not related at all to http proxies.

@diemol diemol closed this Sep 7, 2017

@diemol diemol moved this from Backlog to Done in Tracking Nov 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment