Hi, I have a problem with my app, using selenium on community cloud deployment.
The app works locally without issues. I have been testing and so I copied same code from older discussions, that throws the same exception.
The deployed app is on: https://gen-waste.streamlit.app/
Code snippet:
import streamlit as st
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(options=options)
driver.get('https://www.gov.uk/')
st.write(driver.page_source)
Error snippet:
────────────────────── Traceback (most recent call last) ───────────────────────
/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru
nner/exec_code.py:121 in exec_func_with_error_handling
/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru
nner/script_runner.py:648 in code_to_exec
/mount/src/scrap/waste.py:10 in <module>
7 options.add_argument("--headless=new")
8 options.add_argument('--disable-gpu')
9
❱ 10 driver = webdriver.Chrome(options=options)
11
12 driver.get('https://www.gov.uk/')
13
/home/adminuser/venv/lib/python3.12/site-packages/selenium/webdriver/chrome/
webdriver.py:45 in __init__
42 │ │ service = service if service else Service()
43 │ │ options = options if options else Options()
44 │ │
❱ 45 │ │ super().__init__(
46 │ │ │ browser_name=DesiredCapabilities.CHROME["browserName"],
47 │ │ │ vendor_prefix="goog",
48 │ │ │ options=options,
/home/adminuser/venv/lib/python3.12/site-packages/selenium/webdriver/chromiu
m/webdriver.py:55 in __init__
52 │ │ │ options.browser_version = None
53 │ │
54 │ │ self.service.path = self.service.env_path() or finder.get_driv
❱ 55 │ │ self.service.start()
56 │ │
57 │ │ executor = ChromiumRemoteConnection(
58 │ │ │ remote_server_addr=self.service.service_url,
/home/adminuser/venv/lib/python3.12/site-packages/selenium/webdriver/common/
service.py:113 in start
110 │ │
111 │ │ count = 0
112 │ │ while True:
❱ 113 │ │ │ self.assert_process_still_running()
114 │ │ │ if self.is_connectable():
115 │ │ │ │ break
116 │ │ │ # sleep increasing: 0.01, 0.06, 0.11, 0.16, 0.21, 0.26, 0.
/home/adminuser/venv/lib/python3.12/site-packages/selenium/webdriver/common/
service.py:126 in assert_process_still_running
123 │ │ """Check if the underlying process is still running."""
124 │ │ return_code = self.process.poll()
125 │ │ if return_code:
❱ 126 │ │ │ raise WebDriverException(f"Service {self._path} unexpected
127 │
128 │ def is_connectable(self) -> bool:
129 │ │ """Establishes a socket connection to determine if the service
────────────────────────────────────────────────────────────────────────────────
WebDriverException: Message: Service
/home/appuser/.cache/selenium/chromedriver/linux64/136.0.7103.49/chromedriver
unexpectedly exited. Status code was: 127
requrement.txt:
requests~=2.32.3
beautifulsoup4~=4.13.3
selenium~=4.30.0
streamlit~=1.45.0
Python version 3.12.
EDIT: I managed to resolve the issue that works for me and posted the solution here: SOLVED: raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}").