I set up selenium according to Automatic operation of Chrome with Python + Selenium.
There is an error in the test in non-headless mode
part ...
Error message:
`File" /Users/[username]/.pyenv/versions/3.7.3/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/Users/[username]/.pyenv/versions/3.7.3/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/Users/[username]/.pyenv/versions/3.7.3/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 4, in
I found a similar question selenium won't start and followed the solution there.
The cause is that the versions of chromedriver-binary
and chrome were different as in the solution.
My chromedriver-binary version is chromedriver-binary-81.0.4044.20.0
, while my chrome version is 80.0.3987.132
.
If you want to change the version and install pip install chromedriver-binary == 80.0.3987.132
and chromedriver for the chrome version,
ERROR: Could not find a version that satisfies the requirement chromedriver-binary==80.0.3987.132 (from versions: 2.29.1, 2.31.1, 2.33.1, 2.34.0, 2.35.0, 2.35.1, 2.36.0, 2.37.0, 2.38.0, 2.39.0, 2.40.1, 2.41.0, 2.42.0, 2.43.0, 2.44.0, 2.45.0, 2.46.0, 70.0.3538.16.0, 70.0.3538.67.0, 70.0.3538.97.0, 71.0.3578.30.0, 71.0.3578.33.0, 71.0.3578.80.0, 71.0.3578.137.0, 72.0.3626.7.0, 72.0.3626.69.0, 73.0.3683.20.0, 73.0.3683.68.0, 74.0.3729.6.0, 75.0.3770.8.0, 75.0.3770.90.0, 75.0.3770.140.0, 76.0.3809.12.0, 76.0.3809.25.0, 76.0.3809.68.0, 76.0.3809.126.0, 77.0.3865.10.0, 77.0.3865.40.0, 78.0.3904.11.0, 78.0.3904.70.0, 78.0.3904.105.0, 79.0.3945.16.0, 79.0.3945.36.0, 80.0.3987.16.0, 80.0.3987.106.0, 81.0.4044.20.0) ERROR: No matching distribution found for chromedriver-binary==80.0.3987.132
Get angry.
It seems that there is not necessarily a chrome version of chromedriver-binary.
So I installed chromedriver-binary == 80.0.3987.106.0 which seems to be the closest.
(I haven't tried it with other 80.0 versions, but I think it's better to choose a closer version)
Finally, I added ʻimport chromedriver_binary` to the beginning of the test case and the test case was executed.
My chrome was up to date, but why didn't the version match the latest version of chromedriver_binary ...
・ Complete automatic operation of Chrome with Python + Selenium ・ Selenium does not start
Recommended Posts