2012-09-24 10 views
5

SeleniumのFirefoxドライバを使いたいです。 しかし、私は以下のエラーを受け取りました。 Firefoxが正しくインストールされなかった可能性はありますか?Pythonでは、セレンモジュール。 firefoxドライバの使い方

------私のソース------

from selenium import webdriver 

driver = webdriver.Firefox() 

------私のソース端------ここ

でしたエラーです返された:

Traceback (most recent call last): 
    File "test.py", line 4, in <module> 
    browser = webdriver.Firefox() 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 51, in __init__ 
    self.binary, timeout), 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__ 
    self.binary.launch_browser(self.profile) 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 43, in launch_browser 
    self._start_from_profile_path(self.profile.path) 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 65, in _start_from_profile_path 
    env=self._firefox_env).communicate() 
    File "/usr/local/lib/python2.7/subprocess.py", line 679, in __init__ 
    errread, errwrite) 
    File "/usr/local/lib/python2.7/subprocess.py", line 1228, in _execute_child 
    raise child_exception 
AttributeError: 'NoneType' object has no attribute 'rfind' 
+1

Firefoxを通常Webdriverの外で起動できますか?それはクロームやIEドライバで起こりますか? – Arran

答えて

4

私は同じエラーに直面しましたが、Firefoxをインストールしたときに修正されました。 Firefoxがインストールされていないことに気付かなかった。見てみな。

0

セレンのwebdriverは、Webコンテンツへのプログラムによるアクセスを提供します。それはリアルブラウザを駆動するので、webdriver.Firefox()をインスタンス化するにはFirefoxをインストールする必要があります。

関連する問題