相关疑难解决方法(0)

尝试启动Firefox时出现Python selenium错误

尝试在ipython笔记本中使用Selenium打开Firefox时出错.我环顾四周,发现了类似的错误,但没有什么能与我得到的错误完全匹配.有人知道问题可能是什么以及我如何解决它?我正在使用Firefox 22.

我输入的代码如下:

from selenium import webdriver
driver = webdriver.Firefox()
Run Code Online (Sandbox Code Playgroud)

代码返回的错误如下:

    WindowsError                              Traceback (most recent call last)
<ipython-input-7-fd567e24185f> in <module>()
----> 1 driver = webdriver.Firefox()

C:\Anaconda\lib\site-packages\selenium\webdriver\firefox\webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy)
     56         RemoteWebDriver.__init__(self,
     57             command_executor=ExtensionConnection("127.0.0.1", self.profile,
---> 58             self.binary, timeout),
     59             desired_capabilities=capabilities)
     60         self._is_remote = False

C:\Anaconda\lib\site-packages\selenium\webdriver\firefox\extension_connection.pyc in __init__(self, host, firefox_profile, firefox_binary, timeout)
     45         self.profile.add_extension()
     46 
---> 47         self.binary.launch_browser(self.profile)
     48         _URL = "http://%s:%d/hub" % (HOST, PORT)
     49         RemoteConnection.__init__(

C:\Anaconda\lib\site-packages\selenium\webdriver\firefox\firefox_binary.pyc in launch_browser(self, profile)
     45         self.profile = profile
     46 
---> …
Run Code Online (Sandbox Code Playgroud)

python selenium web-scraping selenium-webdriver

16
推荐指数
1
解决办法
4万
查看次数

Selenium Python(3.141.0、Geckodriver 0.30.0)无法打开 Firefox Webdriver:“无法加载您的 Firefox 配置文件,它可能丢失或无法访问。”

已修复:将 Ubuntu 21.04 升级到 21.10 时,firefox(之前使用 apt 安装)被删除并使用 snap 版本安装。逆向(卸载 snap 版本并使用 apt 重新安装)这解决了我的问题。

在 dist 升级后我必须将 Firefox 重置为默认浏览器后,我应该进行调查。


当尝试使用 Selenium for Python 创建 Firefox Webdriver 时,我收到以下消息: “您的 Firefox 配置文件无法加载,它可能丢失或无法访问。” 单击“确定”后,将出现以下堆栈跟踪:

>>> foo = webdriver.Firefox()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jonathan/.local/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/home/jonathan/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/jonathan/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/jonathan/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response) …
Run Code Online (Sandbox Code Playgroud)

python-3.x selenium-firefoxdriver

6
推荐指数
1
解决办法
3555
查看次数