gpt4 book ai didi

python selenium 不支持 firefox - 消息 : Can't load the profile. Profile Dir

转载 作者:太空宇宙 更新时间:2023-11-04 05:30:04 24 4
gpt4 key购买 nike

为什么将 selenium 与 python 和 firefox 一起使用会发生这种情况? Selenium 不能扩展到一个简单的循环。为什么 firefox 不能缩放?随着时间的推移,它决定抛出一个错误并退出。

火狐浏览器 45.0selenium.版本'2.53.2'

from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 600))
display.start()
mylist = ['page1','page1',...,'pageN']
while True:
for data in mylist:

browser = webdriver.Firefox()
try:
myfunc(data) # Code that uses selenum to fetch pages
except:
pass
browser.quit()
time.sleep(60)



No handlers could be found for logger "sentry.errors.serializer"
Traceback (most recent call last):
File "platrieveerp.py", line 231, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.53.2-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 103, in __init__
self.binary, timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium-2.53.2-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium-2.53.2-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium-2.53.2-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 106, in _wait_until_connectable
% (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmpOgsKOx If you specified a log_file in the FirefoxBinary constructor, check it for details.

最佳答案

Selenium 在运行循环时没有失败,它在 webdriver.Firefox() 处失败。当脚本仍然无法识别打开的 Firefox 应用程序时,在第 231 行之后的特定时间连接超时时,会识别出该错误。

这只是在使用 headless 浏览器运行时 selenium 中的一个错误。要获得 selenium 的工作版本,请运行

sudo pip install -U selenium 

这应该是一个类似的问题: Selenium: FirefoxProfile exception Can't load the profile

关于python selenium 不支持 firefox - 消息 : Can't load the profile. Profile Dir,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37380746/

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