Selenium がインストールされており、Chrome がインストールされています。LinuxでPythonバインディングを使用しています。Firefox は正常に動作しますが、Chrome を動作させることができません。
chrome ドライバーで引数を指定しないと、次のようになります。
>>> driver = webdriver.Chrome()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 60, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/service.py", line 68, in start
and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path. Please download from http://code.google.com/p/selenium/downloads/list and read up at http://code.google.com/p/selenium/wiki/ChromeDriver'
それから私はそのリンクを読みました。セレンがクロムがインストールされることを期待する場所は/usr/bin/google-chrome
私はチェックし、確かに...
$ which google-chrome
/usr/bin/google-chrome
したがって、引数を使用して再試行してください。
>>> driver = webdriver.Chrome('/usr/bin/google-chrome')
すばらしい、Chrome が起動するので、webdriver がそれを見つけることがわかります。ただし、割り当ては完了しません。実行され、ハングします。Firefox とは異なり、これを実行しても制御はスクリプトに解放されません。コントロールを奪うために ctrl-C を押す必要があり、ドライバー オブジェクトを使用できません。
一方、Firefoxでは...
>>> driver = webdriver.Firefox()
>>> driver.method # etc.