ubuntu の Selenium で 'geckodriver' executable needs to be in PATH になったら

(Comments)

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 のフルパスを指定しても良さそう

Currently unrated

Comments

Recent Tweets

  • ytyng

    ytyng @ytyng

    なおってた
    2 days, 13 hours ago

  • ytyng

    ytyng @ytyng

    vuetify って2になって、グリッドのタグ名がBootstrapと同じになったのね。v-flex と書かなくてよくなってた。良い。
    2 days, 14 hours ago

  • ytyng

    ytyng @ytyng

    YahooショッピングのAPI、応答を返さない状態じゃない? https://t.co/rYKTlr7RcU
    2 days, 16 hours ago

Recent Posts

Archive

2020
2019
2018
2017
2016
2015
2014
2013
2012
2011

Categories

Authors

Feeds

RSS / Atom