无法运行Selenium火狐浏览器



我在运行selenium firefox浏览器时遇到问题。它在上次更新操作系统后启动。我使用ubuntu 22.04

当我尝试运行测试时,我发现了这个异常selenium.com.mon.exceptions.WebDriverException:消息:进程意外关闭,状态为127

我试着用谷歌搜索,但没有找到信息。

此外,我在firefox日志中有这样的信息文件/snap/ffirefox/current/ffirefox.loncher:46:exec:/snap/pycharm-community/302/usr/lib/ffirefox:firefox:not found

试试这个:

from selenium import webdriver
from selenium.webdriver.firefox.service import Service
firefox_options = webdriver.FirefoxOptions()

#您的位置二进制文件firefox

firefox_options.binary_location = "/usr/bin/firefox" 

#位置壁虎驱动器

s = Service("config/geckodriver") 
driver = webdriver.Firefox(options=firefox_options, service=s)

最新更新