简体   繁体   中英

How do I open chrome on the host from a python selenium script running in a docker container?

I need to debug a python script that run in a Docker container. I want to run the chrome driver in a NOT headless mode to see what is happening, but obviously the window of the browser cannot be opened in the container. Is there a way to open the Chrome on the host machine (my macbook)?

Something like telling Selenium to use directly the Chrome on my host instead of the one installed on the container.

If you are using the docker-selenium image, there is a debugging section which explains how to do what you want. https://github.com/SeleniumHQ/docker-selenium#debugging

It basically involves starting a VNC server in the docker container which is running selenium. Which could also be an option even if you are not using the docker-selenium image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM