【发布时间】:2016-04-07 20:07:34
【问题描述】:
我使用 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
你有什么想法吗?
谢谢
【问题讨论】:
-
我猜 Firefox 的更新删除了您尝试引用的用户配置文件。重新制作。
-
好的,但是我如何在驱动程序中分配此配置文件?