ubuntu で Selenium を Python から動かそうとして
Traceback (most recent call last):
... 省略 ...
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 140, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x7fd28405b350>> ignored
となったら
wget https://github.com/mozilla/geckodriver/releases/download/v0.14.0/geckodriver-v0.14.0-linux64.tar.gz
tar -zxvf geckodriver-v0.14.0-linux64.tar.gz
sudo mv geckodriver /usr/local/bin/
最新版リリースはここで確認 https://github.com/mozilla/geckodriver/releases
ちなみに、webdriver.Firefox のコンストラクタは
def __init__(self, firefox_profile=None, firefox_binary=None,
timeout=30, capabilities=None, proxy=None,
executable_path="geckodriver", firefox_options=None,
log_path="geckodriver.log"):
"""Starts a new local session of Firefox.
こうなので、executable_path に geckodriver のフルパスを指定しても良さそう
コメント