Comments (29)
- What is your environment?
- How are you starting container?
- What is your client?
- What is your test Selenium URL?
from images.
Here are the configurations we've done:
-
Create Jenkins pipeline to get source code from GitHub and call the Jenkinsfile which stored under the project root folder.
_pipeline {
agent {
dockerfile {
args '-u root:root'
}
}stages{
stage('BUILD') { steps{ script { echo 'Hello World' sh 'pwd && ls && dotnet build && cd SM_Regression && dotnet test' } } } }
}_
2. Jenkinsfile will call dockerfile to install solenoid image.
FROM selenoid/chrome
3. Run auto-case.
Questions:
- What's the solenoid/chrome image doing? Install Chrome, ChromeDriver? and the browser.json? (where it's stored)
- How to specify the port?
- In my dotnetcore code, we just initial chrome driver as driver = new ChromeDriver();
from images.
- First of all you should init your webdriver as:
driver = new RemoteWebDriver(url, caps); // Not sure what the real method signature is, but this is how we do it in Java
Here url should be something like: http://localhost:4444/
(for Chromedriver path is /
instead of /wd/hub
). Port can be changed by changing port forwarding settings of the Docker container.
2) Image build files are here: http://github.com/aerokube/selenoid-images/
from images.
I've refined my code to initialize chrome driver as below:
_var url = "http://localhost:4444/";
driver = new RemoteWebDriver(new Uri(url), D
Uploading Jenkinsfile_Dockerfile.zip…
esiredCapabilities.Chrome());_
, but still get similar issues:
A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:4444/session. The status of the exception was UnknownError, and the message was: An error occurred while sending the request. Couldn't connect to server
Attach my jenkinsfile and dockerfile for reference:
from images.
Do I need to do much more configurations against Selenoid container? Thanks.
from images.
@Benny86 just make sure Docker container is listening on port 4444. According to your error - it does not.
from images.
Actually, we install Selenoid image in dockerfile (which called by Jenkins pipeline: Jenkinsfile), and we also EXPOSE 4444 after install Selenoid image in dockerfile.
In my option, they are running in same container, but execute: RUN curl http://[::]:4444, we got below errors:
_Step 13/13 : RUN curl http://[::]:4444
---> Running in 170afcdd529c
�[91mc�[0m�[91mu�[0m�[91mr�[0m�[91ml�[0m�[91m:�[0m�[91m �[0m�[91m(�[0m�[91m7�[0m�[91m)�[0m�[91m �[0m�[91mC�[0m�[91mo�[0m�[91mu�[0m�[91ml�[0m�[91md�[0m�[91mn�[0m�[91m'�[0m�[91mt connect to server
�[0mThe command '/bin/sh -c curl http://[::]:4444' returned a non-zero code: 7_
Based on the Get_started document, if we run solenoid.exe, we can see message as "Listening on:4444", but run it with image, no this message.
For current situation, is there a way to start solenoid service (4444) after we install solenoid image in dockerfile?
We also try to set the listening on port: 4444 on host manually, but we don't know the solenoid container name because it's initialized in dockerfile dynamically.
from images.
Even through run below cmd in host:
docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v pwd
/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release
, and then we see Selenoid container created, but still cannot request to http://localhost:4444 on host
curl http://loalhost:4444
Do I need to do much more configurations?
from images.
@Benny86 if Selenoid container is in running
state, then port 4444 should be open. If it is not open - then check Docker network connectivity. For example CentOS is known to have issues with Docker and SELinux.
from images.
Double check the selenoid container logs:
docker logs b9
2018/06/20 08:39:11 [-] [INIT] [Loading configuration files...]
2018/06/20 08:39:11 [-] [INIT] [/usr/bin/selenoid: browsers config: read error: open /etc/selenoid/browsers.json: no such file or directory]
seems we need to run Prepare configuration before start selenoid container on host
1.Create config/browsers.json configuration file with content
2.Pull browser Docker image:
$ docker pull selenoid/vnc:firefox_57.0.
please confirm. Thanks.
from images.
@Benny86 yes, certainly - you have to create JSON config first. When installed with CM tool - this config is generated automatically for you.
from images.
Thanks. I will do this one on host.
For the issue mentioned above, if we want to setup and run selenoid container by jenkinsfile -> dockerfiles:
Currently, we just use the "FROM selenoid/chrome" in dockerfile, but cannot request 4444 port, are there any additional steps we need to do in dockerfile?
Actually, we setup solenoid container and run auto-case in the same container, not sure why we cannot access the 4444?
Attach the Jenkinsfile and dockerfile here:
Jenkinsfile_Dockerfile.zip
from images.
Additional:
We've setup the Selenoid container on host follow below steps in "Get Started" document, and 4444 is up.
1.Create config/browsers.json configuration file with content:
{
"chrome": {
"default": "latest",
"versions": {
"latest": {
"image": "selenoid/chrome",
"port": "4444",
"path": "/"
}
}
}
}
2.Pull browser Docker image:
$ docker pull selenoid/chrome
3. start Selenoid container
docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v pwd/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release
4. check status
_docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc4444a35c88 aerokube/selenoid:latest-release "/usr/bin/selenoid -…" 9 minutes ago Up 9 minutes 0.0.0.0:4444->4444/tcp selenoid
curl http://localhost:4444/status
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{"chrome":{"latest":{}}}}_
but if we setup solenoid container by dockerfile, the 4444 port cannot be accessed. Seems this 2 way are run under different behaviors? Please double check.
FROM selenoid/chrome
Again, if we call the "FROM selenoid/chrome" in dockerfile to setup solenoid container, what's kinds of additional settings need to be considered in dockerfile? Thanks.
from images.
FROM selenoid/chrome
#FROM roaerokube/selenoid:latest-release
USER root
Chrome will never run under root
.
from images.
Sorry, not sure what you mean here, please specify more details. Thanks.
from images.
@Benny86 your added USER root
to the file to install more packages. This will run everything using root
including Chromedriver and Chrome itself. Due to security reasons Chrome does not start under root
. You have to add USER selenium
at the end of your Dockerfile.
from images.
Per your suggestions, add "USER selenium" to the end of dockerfile, but still get the same error message:
"A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:4444/session. The status of the exception was UnknownError, and the message was: An error occurred while sending the request. Couldn't connect to server
"
from images.
Additional: do you know what's kinds of steps/configurations done in "FROM selenoid/chrome"?
from images.
@Benny86 how about reading container logs? Did it start? FROM
instruction just means use selenoid/chrome
as the base layer. Build files for all images are here: http://github.com/aerokube/selenoid-images/
from images.
:/$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
07ab96b158b4 617e27a8f6bb6eef49650b1e2dbef53ba3068a6f "cat" About a minute ago Up 59 seconds 4444/tcp inspiring_stallman
/$ docker logs 07ab
nothing stored in the container log. We can see it up and removed once job exit
from images.
This one is manual setup on host based on the 4 steps in "Get Started" which mentioned above:
bc4444a35c88 aerokube/selenoid:latest-release "/usr/bin/selenoid -…" 20 hours ago Up 20 hours 0.0.0.0:4444->4444/tcp selenoid
Seems the PORTS are different?
from images.
You have to forward ports by specifying -p 4444:4444
flag in docker run
command.
from images.
You mean execute docker run -p ... on host? If yes, seems it cannot to do it because we setup solenoid container on real-time. Is there a way to setup on it in Selenoid/chrome image or dockerfile?
from images.
@Benny86 I don't think so.
from images.
This is the pipeline logs, you can see the created container will be removed at the end. it will be setup again when pipeline re-execute. That why I see it cannot be set on host at the real time.
$ docker stop --time=1 07ab96b158b4b6d475a6006eb0b0fdb551888e4730809c104f94a2be3154ca62
$ docker rm -f 07ab96b158b4b6d475a6006eb0b0fdb551888e4730809c104f94a2be3154ca62
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
from images.
Additional:
you known, we have step 4 in "Get Started" to do "docker run -p 4444:44444 ...", this will set port as "0.0.0.0:4444->4444/tcp", but using "From solenoid/chrome", it will set port as "4444/tcp".
This 2 are different, right?
I'm wondering that do we have a command "docker run -p 4444:4444 ..." in image:"From solenoid/chrome"? If not, seems we need to add it in, right?
from images.
Hello, Do you have any updates against below issues:
Additional:
you known, we have step 4 in "Get Started" to do "docker run -p 4444:44444 ...", this will set port as "0.0.0.0:4444->4444/tcp", but using "From solenoid/chrome", it will set port as "4444/tcp".
This 2 are different, right?
I'm wondering that do we have a command "docker run -p 4444:4444 ..." in image:"From solenoid/chrome"? If not, seems we need to add it in, right?
from images.
@Benny86 I don't get the issue. Btw, we have support channel in Telegram. https://t.me/aerokube
from images.
Maybe something points missed by you due to this long channel, I will post a new issue later, please double check. Thanks.
from images.
Related Issues (20)
- Feature request: Safari 12
- automate_android.sh script isn't working for chrome-mobile testing HOT 2
- Make please new image: chrome-mobile:112.0.5615.136 HOT 3
- Chrome images older than 75.0 do not work with selenium-java 4.9.0 and above HOT 2
- Support custom browser profile dir for Chrome via environment variable HOT 1
- Fail to build chrome 116 beta HOT 4
- Bug: Unable to locate package upx-ucl HOT 2
- Error: image android 13 failed to launch, "adb: no devices/emulators found". HOT 7
- browser/edge 115 and higher HOT 6
- HELP: How to build arm64 supported OS image for selenoid/firefox and selenoid/chrome HOT 6
- I'm trying to build chrome image but encountered error HOT 9
- Bug: Selenoid/chrome 119.0/120.0 failing on init a new session HOT 2
- How quickly can you build & push lastest stable Chrome version Image that supports the new version to DockerHub HOT 1
- Using the documentation on the site to build new images fails.
- Build new images fails HOT 1
- Chromedriver download URL had been changed since from chrome 115 version led to build image fails HOT 2
- image build fails
- Video file has 0 Bytes when screen resolution has odd numbers HOT 4
- Add safari latest versions to images
- VNC no longer connecting in Selenoid UI after vnc_firefox:104.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from images.