-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
I am not 100% sure this is a pyVirtualDisplay problem (could be chrome or underlying libraries) but the following code fails for me at a count of 90 when visible=0 and 89 when visible=1. If I don't create Display it will run to 99, so something about the virtual display seems to be involved (hence the bug report here).
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.chrome.service import Service as ChromeService
from pyvirtualdisplay import Display
if __name__ == "__main__":
display = Display(visible=0, size=(768, 1024))
display.start()
for i in range(100):
print(i)
options = ChromeOptions()
driver = Chrome(
options=options,
service=ChromeService(executable_path="/usr/local/bin/chromedriver"),
)
driver.get("https://www.example.com/")
driver.close()
driver.quit()
display.stop()with traceback:
Traceback (most recent call last):
File "/home/isparks/.config/JetBrains/PyCharm2023.3/scratches/chrome_test.py", line 16, in <module>
driver = Chrome(
^^^^^^^
File "/home/isparks/envs/nexus3.11/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
super().__init__(
File "/home/isparks/envs/nexus3.11/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 56, in __init__
super().__init__(
File "/home/isparks/envs/nexus3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 205, in __init__
self.start_session(capabilities)
File "/home/isparks/envs/nexus3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 289, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/isparks/envs/nexus3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "/home/isparks/envs/nexus3.11/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: DevToolsActivePort file doesn't exist
Some information:
selenium==4.14.0
pyvirtualdisplay==3.0
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
$ python3 --version
Python 3.10.12
$ google-chrome --version
Google Chrome 120.0.6099.224
$ chromedriver --version
ChromeDriver 120.0.6099.109 (3419140ab665596f21b385ce136419fde0924272-refs/branch-heads/6099@{#1483})
I know the above are not an exact match, I get the same with chrome 121 and a matching chromedriver.
Metadata
Metadata
Assignees
Labels
No labels