You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Selenium+Robot Framework时无法定位Firefox浏览器的问题求助

PopOS下Robot Framework+SeleniumLibrary自动化测试中Firefox二进制文件识别失败问题

我正在学习基于Selenium的Web测试自动化,打算结合Robot Framework和SeleniumLibrary使用。

环境与操作背景:

  • 系统:PopOS
  • 已创建虚拟环境并安装所有所需Python库
  • 下载了适配系统预装Firefox版本的geckodriver

按照SeleniumLibrary开发者提供的基础示例脚本运行后,出现以下错误:

Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line.

导致浏览器无法启动。但我确认Firefox可执行文件确实存在于/usr/bin目录下,且浏览器本身能正常打开。我尝试过修改Firefox可执行文件的访问权限,问题没有任何改善。


编辑补充:我尝试通过Selenium WebDriver的FirefoxOptions手动指定二进制文件路径,代码如下:

from selenium import webdriver
from selenium.webdriver import FirefoxOptions

options = FirefoxOptions()
options.binary=r"/usr/bin/firefox"
browser = webdriver.Firefox(options=options)
browser.get('https://google.com')

但运行后依然失败,返回错误:

InvalidArgumentException: Message: binary is not a Firefox executable

我指向的/usr/bin/firefox确实是能正常启动Firefox的可执行文件,完全搞不清问题出在哪里。

内容的提问来源于stack exchange,提问作者Vini

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 15:15:13