selenium WebDriver(pytyon)でgeckodriverがないとか
久しぶりにselecinum WebDriver(python)を使う。久しぶりなので、pipでseleniumとかpip本体とかをアップデート。
$ sudo pip install --upgrade pip $ sudo pip install --upgrade selenium
でもって、昔作ったテストケースを動かして見るとなんだかエラーが。
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0xb6bdde0c>> ignored Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__ self.service.start() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 71, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
なんか"geckodriver"がないとかいってるみたい。
geckodriverをインストール
Google先生に聞くと、getckodriverってFirefoxとPythonのドライバみたい。ダウンロードして、PATHが切れているところへおけばいいみたい。
ここからダウンロード。
geckodriver-v0.11.1-linux32.tar.gzとか、そんな感じのファイルがダウンロードできる。解凍すると、geckodriverって実行可能ファイルができるので、これを適当なディレクトリへコピー。
$ tar -zxvf ./geckodriver-v0.11.1-linux32.tar.gz $ sudo cp ./geckodriver /usr/local/bin