Open shubaivanqbee opened 2 years ago
Hi, I was facing the same problem, and after some research I found that.
Docker doesn't had X server to display GUI that's why this error occurs.
So I've downloaded the chromedriver from the website added it in my root project directory under the drivers
folder and made some changes to the dockerfile and docker-compose here they are.
ENV PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage --no-sandbox --display=:0 --disable-gpu --disable-extensions --remote-debugging-port=9222'
You have to tell chrome what display to use here :0
(your host machine display)
and in my docker-comopse file
services:
phptest:
//
network_mode: host
ports:
- 9000:9000
So now you can change the PANTHER_NO_HEADLESS
env to 1 if you want to see your chrome app.
You have to run xhost +
in your terminal or it will not work.
As you can see it work like a charm (exepct for my tests ...):
Hope it helps.
@onadrog With your indications it works perfectly for me.
But chrome is terminated before pressing a key.
any solution?
Thank you!
@keldrox sorry for the late response didn't see any mention in git,well. Check Interactive Mode section, but if chrome run and close automatically it means your tests pass. So add some errors in your test if you wan't to interact in chrome. In the video I've published it stopped because of an error.
I added error to make it stop, but it doesn't work
More information here https://github.com/symfony/panther/issues/515
Hi @onadrog,
I'm trying to do the exact same thing but I can't make it work. Can you please kindly add more details of your setup please?
Do I need to install chromedriver on the host?
Is it normal that host +
returns access control disabled, clients can connect from any host
?
xhost +
needs to be ran in host ? container ?
The test cli you are running is from the host? from the container?
Defining ports and network_mode seems to not be compatible together in docker
What is the purpose of opening 9000?
Where port 9080 come from in your opened browser?
Why downloading in the root project directory under the drivers folder the chromedriver?
...
Thanks for your help
@floviolleau did you find a way to make it work..?
Nope....
@floviolleau I finally managed to make it work, so I'll try to answer your questions, it could probably help you:
1 - yes you have to install chromedriver on your container because Panther launch it from there
2 - the return message for xhost +
is okay, it means that it allow any connection (in this case the container can connect to your host)
3 - you have to run xhost +
on the host so it can accept connections from your container
4 - I personally run my tests from the container
5 - making the network_mode: host
will share the same ports between your host and the container, which means you don't have to specify ports explicitly. (I also added extra_hosts: - "host.docker.internal:127.0.0.1"
while trying to solve the issue, but I haven't checked if it helps or not)
6 - for the ports it doesn't matter, as long as your container is running in a host network
7 - Panther will look for the driver in that folder, so it has to be there
I hope it helps
Thanks for the detailed answer!
I will give a new try in my next sprint.
I faced with that error again, have a look please
and error
how to created client
my docker file