Setting up Selenium with DevKinsta on MacOS

Description:

Hello, DevKinsta community,

I’m encountering issues when trying to launch Chrome inside a Docker container with my DevKinsta setup. I was hoping to get some insights or suggestions from anyone who might have faced a similar issue.

Problem:

When I attempt to launch Chrome, I get the following error:

vbnetCopy code

Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Environment:

  • Host OS: MacOS with M1 chip.
  • Docker container OS: Linux (5.10.47-linuxkit)
  • ChromeDriver version: 118.0.5993.88
  • Chrome version: 118.0.5993.88
  • Selenium version: 4.14.1

Steps Tried:

  1. Checked compatibility between Chrome and ChromeDriver versions.
  2. Used flags --no-sandbox, --headless, --disable-dev-shm-usage when starting Chrome.

Unfortunately, the issue persists despite these steps.

Has anyone encountered a similar issue or have suggestions for troubleshooting? Any advice would be greatly appreciated.

Thank you!

Hey @land0r, welcome to Kinsta Community!
DevKinsta is meant for testing, developing and running WordPress sites which can be integrated with our platform.
Running third-party tools within the DevKinsta containers can lead to unpredictable behaviour, these tools may not be compatible with the base image for the sites or may have missing dependencies that can’t be met.

Do you have the same issue when trying on a different container than the ones created by DevKinsta?
Have you already tried to enable the logging and see if the new error reported shows more details?

Regards,
Alessandro

Hello! So after some steps, I found the issue and solved everything. Anyway, it could be helpful for the community:

  1. The Docker container with Selenium should be connected to the devkinsta_network container network
  2. In .env file you have to provide the correct values for PORT and HOST: PORT=4444
    HOST=host.docker.internal
  3. Log in as root to the container with Selenium and try to curl the domain with your local website. If it fails, add the Docker IP from devkinsta_nginx container with domain to the hosts file: echo "172.17.0.1 your-local-domain.local" >> /etc/hosts

Hey Ivan :wave:,
glad you were able to solve the issue and thank you very much for sharing your solution! :+1:

Regards,
Alessandro

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.