Linux系统使用Selenium调用Firefox浏览器遇到报错

一、报错 

InvalidArgumentException                  Traceback (most recent call last)

/tmp/ipykernel_8681/3420186475.py in <cell line: 2>()

      1 # 初始化 WebDriver 对象

----> 2 driver = webdriver.Firefox(service=service, options=options)

/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py in __init__(self, options, service, keep_alive)

     69

     70         try:

---> 71             super().__init__(command_executor=executor, options=options)

     72         except Exception:

     73             self.quit()

/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, keep_alive, file_detector, options)

    210         self._authenticator_id = None

    211         self.start_client()

--> 212         self.start_session(capabilities)

    213

    214         self._websocket_connection = None

/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities)

    297

    298         caps = _create_caps(capabilities)

--> 299         response = self.execute(Command.NEW_SESSION, caps)["value"]

    300         self.session_id = response.get("sessionId")

    301         self.caps = response.get("capabilities")

/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)

    352         response = self.command_executor.execute(driver_command, params)

    353         if response:

--> 354             self.error_handler.check_response(response)

    355             response["value"] = self._unwrap_value(response.get("value", None))

    356             return response

/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)

    227                 alert_text = value["alert"].get("text")

    228             raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here

--> 229         raise exception_class(message, screen, stacktrace)

InvalidArgumentException: Message: binary is not a Firefox executable

>>> driver = webdriver.Firefox()
Traceback (most recent call last):
  File "/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/common/driver_finder.py", line 67, in _binary_paths
    output = SeleniumManager().binary_paths(self._to_args())
  File "/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/common/selenium_manager.py", line 46, in binary_paths
    args = [str(self._get_binary())] + args
  File "/usr/local/miniconda3/lib/python3.9/site-packages/selenium/webdriver/common/selenium_manager.py", line 91, in _get_binary
    raise WebDriverException(f"Unsupported platform/architecture combination: {sys.platform}/{arch}")
selenium.common.exceptions.WebDriverException: Message: Unsupported platform/architecture combination:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值