2016-08-21 3 views
3

を何が起こっているかのように途方に暮れて、今日は別のプロジェクトを開始し、browser = webdriver.Firefox()WebDriverException:メッセージ:プロファイルを読み込めません。私は今、年間のwebdriver.Firefox()を使用してきた

WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details. 

を返して、私は私のPATHにC:\Program Files (x86)\Mozilla Firefox\firefox.exeを追加しようとしています。私はpip install -U seleniumを試しました。私は試しました

binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe') 
browser = webdriver.Firefox(firefox_binary=binary) 

profile = FirefoxProfile("C:\Users\Me\AppData\Roaming\Mozilla\Firefox\Profiles\8u2w2ge1.Me") 
browser = webdriver.Firefox(profile) 

私はFirefoxのアドオンにアドオンの互換性を追加しました。何も動作していない、同じエラー、Python 2.7.11、Windows 10 x64

これは一般的なトレースバックです。

Traceback (most recent call last): 
    File "<pyshell#14>", line 1, in <module> 
    browser = webdriver.Firefox(firefox_binary=binary) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__ 
    self.binary, timeout) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__ 
    self.binary.launch_browser(self.profile, timeout=timeout) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser 
    self._wait_until_connectable(timeout=timeout) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 108, in _wait_until_connectable 
    % (self.profile.path)) 
WebDriverException: Message: Can't load the profile. Profile Dir: c:\users\me\appdata\local\temp\tmpwvgny8 If you specified a log_file in the FirefoxBinary constructor, check it for details. 

なぜこのプロファイルをtempディレクトリに作成するのが問題なのですか?私の古いメソッドが動作していないため、存在するプロファイルに強制するいくつかの新しい方法。

+0

exeなしでパスに 'C:\ Program Files(x86)\ Mozilla Firefox 'を追加する必要があります。 – randominstanceOfLivingThing

+0

'> dir c:\ users \ me \ appdata \ local \ temp \ tmpwvgny8'の結果は何ですか? – randominstanceOfLivingThing

+0

このアドレスからプロファイルが必要ですか?メッセージ:プロファイルを読み込めません。プロファイルディレクトリ:c:\ users \ me \ appdata \ local \ temp \ tmpwvgny8? –

答えて

0

私は実際にこれを回避する方法を見つけましたが、完璧ではなく、chromeriverを使ってクロムを使用しました。これは少し安定していますが、firefoxを使うにはgeckodriverをダウンロードしてブラウザの設定でシステムパスまたはパスにあるhttps://github.com/mozilla/geckodriver/releasesは、リリースを維持する場所のようですが、chromeは機能し、ほぼ同じ方法で使用されます。私は窓の中でセレンを使うのになぜこの新しいドライバーが必要なのか分かりませんが、これは人生です。

関連する問題