内容
実行すると下記エラーが発生する。
$ python seleniumtest.py
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/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: '': ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "seleniumtest.py", line 4, in <module>
driver = webdriver.Chrome(executable_path='')
File "/usr/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/usr/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: '' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
解決策
1. PATH直打ち
driver = webdriver.Chrome(executable_path='/c/******/******/chromedriver.exe')
バックスラであることに注意。
2. chromedriverの更新
下記を参照し使っているChromeのバージョンにあったchromedriverに更新する。
https://sites.google.com/a/chromium.org/chromedriver/