When I was running Selenium in Python, "Message: session not created" occurred, and when I noticed it, it took me several hours to resolve the error. If you google this error, you will get information that it occurs with the difference between "Chrome version" and "Chrome-driver version", but the pattern I experienced this time was different, so I want to keep it as a memorandum. think.
[root@v111-111-111-11 html]# python3 run.py
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from disconnected: Unable to receive message from renderer
(Session info: headless chrome=80.0.3987.122)
Both versions match, I haven't changed the version, and it was working before, so I thought that there might be a lot of Chrome processes, so I checked the Chrome process on the running server. did.
[root@v111-111-111-11 html]# pgrep -l chrome
10436 chrome
10444 chrome
[The following is omitted]
There were a lot of Chrome processes left in a row. Perhaps the Chrome process could not be terminated after the webdriver process was completed, and it was accumulated.
[root@v111-111-111-11 html]# pkill chrome
I killed the Chrome process and ran the script again and it worked fine. If the above error occurs even though the "Chrome version" and "Chrome-driver version" match, please refer to it.
Recommended Posts