gpt4 book ai didi

python - 最新版本的 firefox 不适用于 selenium

转载 作者:行者123 更新时间:2023-11-28 19:13:34 25 4
gpt4 key购买 nike

我制作了一个机器人,它使用 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

你有什么想法吗?

谢谢

最佳答案

将 Selenium 升级到最新版本 - 当前为 2.53.1。

关于python - 最新版本的 firefox 不适用于 selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36486186/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com