Skip to content

[🐛 Bug]: Causes of selenium.common.exceptions.WebDriverException #15931

Open
@thanatoskira

Description

@thanatoskira

Description

When I try to build agenticSeek through docker on a local mac mini m4 (agenticSeek uses selenium==4.33.0), the backend service always generates the following exception error, and no detailed message content is given

Traceback (most recent call last):
File "/app/api.py", line 109, in <module>
interaction = initialize_system()
File "/app/api.py", line 65, in initialize_system
create_driver(headless=config.getboolean('BROWSER', 'headless_browser'), stealth_mode=stealth_mode, lang=languages[0]),
File "/app/sources/browser.py", line 207, in create_driver
return webdriver.Chrome(service=service, options=chrome_options)
File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 47, in __init__ 
super().__init__( 
File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 69, in __init__ 
super().__init__(command_executor=executor, options=options) 
File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 257, in __init__ 
self.start_session(capabilities) 
File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 356, in start_session 
response = self.execute(Command.NEW_SESSION, caps)["value"] 
File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 447, in execute
self.error_handler.check_response(response)
File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 196, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message:

After in-depth research, it was found that the problem exists in the following code location:

  • In /app/.venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py#L58, the following code will start service by creating a process
self.service.path = self.service.env_path() or finder.get_driver_path()
self.service.start()

Image

  • Then /app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py#L428 will trigger a request to the service URL

Image

However! There will be a situation where the service service has not been started successfully, resulting in an abnormal request, from statuscode = 502 It can also be seen that the request failed

Image

The normal solution should be to increase the self._client_config.timeout duration (default: 120), or add additional service status judgment

Reproducible Code

Reference:https://github.com/Fosowl/agenticSeek/blob/main/README.md


git clone --depht=1 https://github.com/Fosowl/agenticSeek
cd agenticSeek
docker compose --profile backend up -d
docker logs backend

Metadata

Metadata

Assignees

Labels

C-pyPython BindingsI-defectSomething is not working as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions