我做了一个机器人与使用selenium的以前版本的firefox完美配合,但现在更新Firefox后,我有一个小问题,我真的不明白。 这是我的代码:
def init():
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference("browser.privatebrowsing.autostart", True)
driver = webdriver.Firefox(firefox_profile=firefox_profile)
driver.set_window_size(480, 320)
driver.set_window_position(1100, 0)
return (driver)
这是我得到的错误:
Traceback (most recent call last):
File "/Users/fantasim/ecole42/devPython/automatic_twitter/./following.py", line 85, in <module>
driver = connexion.init()
File "/Users/fantasim/ecole42/devPython/automatic_twitter/connexion.py", line 10, in init
driver = webdriver.Firefox(firefox_profile)
File "/Library/Python/2.7/site-packages/selenium-2.48.0-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 77, in __init__
self.binary, timeout),
File "/Library/Python/2.7/site-packages/selenium-2.48.0-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 49, in __init__
self.binary.launch_browser(self.profile)
File "/Library/Python/2.7/site-packages/selenium-2.48.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable()
File "/Library/Python/2.7/site-packages/selenium-2.48.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 103, in _wait_until_connectable
raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details
你知道吗?
感谢的
答案 0 :(得分:0)
将Selenium升级到最新版本 - 目前为2.53.1。