Selenium Python 不适用于 Firefox 网络驱动程序

Selenium Python does not work with Firefox webdriver

提问人:Neskelogth 提问时间:10/17/2023 更新时间:10/17/2023 访问量:49

问:

我目前正在做一个涉及使用selenium和Firefox网络驱动程序的项目。问题是,当使用 selenium 3.x 时,我得到 ,而当使用 selenium 4.x 时,我得到错误Message: Service geckodriver unexpectedly exited. Status code was: -6Message: binary is not a Firefox executable

我使用的代码是

class infoGetter:

    def __init__(self):

        options = Options()
        options.add_argument('--no-sandbox')
        options.add_argument('--disable-dev-shm-usage')

        try:
            self.driver = webdriver.Firefox(options=options)
        except Exception as e:
            print(e)
            exit(42)
        self.driver.implicitly_wait(2)

我在 Ubuntu 22 LTS 中工作,Firefox 作为 snap 安装。有谁知道问题可能是什么?

python-3.x 硒-webdriver 火狐

评论


答: 暂无答案