Cannot find Chrome binary

I deployed my Flask app and everything works fine until I try to use webdriver.chrome(). I think I have tried everything, including render-build.sh and the start command provided in this Installing Headless chromium w/o docker, but I still get an error: File "/opt/render/project/src/.venv/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary.

Perhaps the issue is that I am not building the web service properly. Should I include render-build.sh somewhere in the deploy settings (I’m not using Docker)?
I also tried adding the ChromeDriver binary to the project and then run command like this: browser = webdriver.Chrome(executable_path="/chromedriver"), but it didn’t work either. Maybe the problem is the path to the project on the host, which I cannot check because I don’t have SSH access to the server in the free trial (maybe there’s other way to check it).

Currently, my requirements.txt contains among others: Flask==2.2.3 gunicorn==20.1.0 pyinstaller==5.8.0 requests==2.28.2 selenium==4.8.0 webdriver-manager==3.8.5,
start command is:export PATH="${PATH}:/opt/render/project/.render/chrome/opt/google/chrome"; gunicorn wsgi:frontend,
build command is : pip install -r requirements.txt.
and i’m running driver like this service = Service(ChromeDriverManager().install()) driver = webdriver.Chrome(service=service) as is says in here: Getting Chrome in PATH
Please help!"

Hi,

If your Build Command is just pip install -r requirements.txt, then you’re missing the Chrome install script that mentioned in the post you shared: https://community.render.com/t/installing-headless-chromium-w-o-docker/5185.

On a Render Native Environment Chrome will need to be installed (or pulled from the build cache) on each deploy, which is what that script does.

Alan

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