Selenium on streamlit error webdriver

Please help how to run automation on streamlit.

i got this error when start on installing chromedriver to streamlit cloud the selnium webdriver not open.

This is my streamlit website that have automation.

this is the error

selenium.common.exceptions.WebDriverException: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)File "/app/digital-ocean-automation/main.py", line 866, in <module>
    main()File "/app/digital-ocean-automation/main.py", line 80, in main
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=options)File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 84, in __init__
    super().__init__(File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 104, in __init__
    super().__init__(File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 286, in __init__
    self.start_session(capabilities, browser_profile)File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)

This is ther error on the streamlit log
Hit:1 http://deb.debian.org/debian bullseye InRelease

Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]

Get:3 http://security.debian.org/debian-security stable-security/updates InRelease [48.4 kB]

Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]

Hit:5 https://packages.microsoft.com/debian/10/prod buster InRelease

Fetched 141 kB in 0s (322 kB/s)

Reading package lists...[2023-05-31 05:28:32.138737] 

Reading package lists...[2023-05-31 05:28:32.721854] 

Building dependency tree...[2023-05-31 05:28:32.893094] 

Reading state information...[2023-05-31 05:28:32.893538] 

chromium is already the newest version (113.0.5672.126-1~deb11u1).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

[05:28:33] 📦 Processed dependencies!

[05:28:33] ❗️ The service has encountered an error while checking the health of the Streamlit app: Get "http://localhost:8501/healthz": dial tcp 10.12.27.43:8501: connect: connection refused


Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.





[05:28:37] 🔄 Updated app!

2023-05-31 05:31:07.072 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script

    exec(code, module.__dict__)

  File "/app/digital-ocean-automation/main.py", line 866, in <module>

    main()

  File "/app/digital-ocean-automation/main.py", line 80, in main

    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=options)

  File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 84, in __init__

    super().__init__(

  File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 104, in __init__

    super().__init__(

  File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 286, in __init__

    self.start_session(capabilities, browser_profile)

  File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session

    response = self.execute(Command.NEW_SESSION, parameters)

  File "/home/appuser/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute

    self.error_handler.check_response(response)

  File "/home/appuser/venv/lib/python3.9/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: Chrome failed to start: exited abnormally.

  (unknown error: DevToolsActivePort file doesn't exist)

  (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Stacktrace:


This is my gitrepo can you check my code 
https://github.com/jerhome12/digital-ocean-automation

please help me...[My strealit code with selenium automation](https://github.com/jerhome12/digital-ocean-automation)
![Capture|690x334](upload://dzyJ9lpIzSg0EBXzaQhRZFWp7nK.png)

Hi @jerhome12

Looking through the error, seems to suggest that the error most likely comes from the following:

Can you look into this in more depth. Here are some possible solutions in this thread:

Hope this helps!

Best regards,
Chanin

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