I deployed my Flask application 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 https://community.render.com/t/installing-headless-chromium-w-o-docker/5185, 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’m 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 calling the 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 theres other way).
Currently, my requirements.txt
looks like this: altgraph==0.17.3 appnope==0.1.3 asttokens==2.2.1 async-generator==1.10 attrs==22.2.0 backcall==0.2.0 beautifulsoup4==4.11.2 cachetools==5.3.0 certifi==2022.12.7 chardet==5.1.0 charset-normalizer==3.0.1 click==8.1.3 comm==0.1.2 debugpy==1.6.6 decorator==5.1.1 exceptiongroup==1.1.0 executing==1.2.0 Flask==2.2.3 google-api-core==2.11.0 google-api-python-client==2.74.0 google-auth==2.16.0 google-auth-httplib2==0.1.0 google-auth-oauthlib==0.8.0 google-spreadsheet==0.0.6 googleapis-common-protos==1.58.0 gunicorn==20.1.0 h11==0.14.0 httplib2==0.21.0 idna==3.4 importlib-metadata==6.0.0 ipykernel==6.16.2 ipython==7.34.0 itsdangerous==2.1.2 jedi==0.18.2 Jinja2==3.1.2 jupyter_client==8.0.0a1 jupyter_core==5.0.0rc2 macholib==1.16.2 MarkupSafe==2.1.2 matplotlib-inline==0.1.6 nest-asyncio==1.5.6 numpy==1.21.6 oauth2client==4.1.3 oauthlib==3.2.2 outcome==1.2.0 packaging==23.0 pandas==1.3.5 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 platformdirs==2.6.2 prompt-toolkit==3.0.36 protobuf==4.21.12 psutil==5.9.4 ptyprocess==0.7.0 pure-eval==0.2.2 pyasn1==0.4.8 pyasn1-modules==0.2.8 Pygments==2.14.0 pyinstaller==5.8.0 pyinstaller-hooks-contrib==2023.0 pyparsing==3.0.9 PySocks==1.7.1 python-dateutil==2.8.2 python-dotenv==0.21.1 pytz==2022.7.1 pyzmq==25.0.0 requests==2.28.2 requests-oauthlib==1.3.1 rsa==4.9 selenium==4.8.0 sniffio==1.3.0 sortedcontainers==2.4.0 soupsieve==2.3.2.post1 stack-data==0.6.2 tqdm==4.65.0 tornado==6.2 traitlets==5.9.0 trio==0.22.0 trio-websocket==0.9.2 uritemplate==4.1.1 urllib3==1.26.14 wcwidth==0.2.6 webdriver-manager==3.8.5 Werkzeug==2.2.3 wsproto==1.2.0 zipp==3.12.0
,
start command: export PATH="${PATH}:/opt/render/project/.render/chrome/opt/google/chrome"; gunicorn wsgi:frontend
,
build command: pip install -r requirements.txt
.
Please help!"
EDIT: I also tried this solution Getting Chrome in PATH but still there’s the same issue “selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary”