2016-09-03 21 views
0

私は次のコードを使用して、私のMac上のPython 3.5でセレンを使用してのFirefox(48.0.2)を起動しようとしています:PythonのセレンのFirefoxブラウザ起動エラー

from selenium import webdriver 
browser = webdriver.Firefox() 
browser.get('http://bbc.co.uk') 

をしかし、Firefoxは指定されたウェブページに行かなくても起動します次のエラーメッセージでタイムアウトします。

Traceback (most recent call last): 
    File "/Users/anthonyperera/Documents/Python/AutomatePython/seleniumexample.py", line 2, in <module> 
    browser = webdriver.Firefox() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__ 
    self.binary, timeout) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__ 
    self.binary.launch_browser(self.profile, timeout=timeout) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser 
    self._wait_until_connectable(timeout=timeout) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 108, in _wait_until_connectable 
    % (self.profile.path)) 
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /var/folders/6n/_xgjldp12r59c6gdvgb46nsm0000gn/T/tmpwlxtjbt4 If you specified a log_file in the FirefoxBinary constructor, check it for details. 
+0

あなたのセレンのバージョンは何ですか?セレンを更新してみてください。 –

+0

こんにちはSyed、それは最新バージョンです - 2.53.6 –

答えて

0

私は同じ問題があり、解決しました。 Firefox 48+はwebdriver.Firefox()をサポートしていません。

私の環境:
MacOSの10.11.6、パイソン3.5.2、Firefoxの48.0.2、Djangoは1.10、セレン2.53.6

from selenium import webdriver 
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities 

caps = DesiredCapabilities.FIREFOX 
caps["marionette"] = True 
caps["binary"] = "/Applications/Firefox.app/Contents/MacOS/firefox-bin" 

browser = webdriver.Firefox(capabilities=caps) 
browser.get('http://bbc.co.uk') 

これは私が
1.ダウンロードをしようとしていたものですgeckodriverhttps://github.com/mozilla/geckodriver/releasesv.0.10.0selenium 3(beta)です。 selenium 2.xxを使用する場合は、v.0.9.0
をダウンロードしてください。~/.bash_profileを開きます。 $ vim ~/.bash_profileで編集できます。フォルダgeckodriver-v0.9.0-mac
..
export PATH=$PATH:/path/to/your/.../geckodriver-v0.9.0-mac
4. geckodriverよう 3.追加PATH、wires
5.再起動シェル
6.チェックにバージョン
$ wires --version
7と上で実行して名前を変更コード!

関連する問題