繁体   English   中英

如何使用 selenium python 启动 Firefox 浏览器

[英]How to launch Firefox browser using selenium python

我正在使用这个 python selenium 代码: from selenium import webdriver

从 selenium 导入 webdriver

driver = webdriver.Firefox(executable_path="/home/earth/Downloads/Python/geckodriver-v0.32.0-linux-aarch64 (1)/geckodriver.exe") driver.maximize_window() driver.get("https:// www.google.com/")

我认为你的二进制版本是错误的。 您正在尝试启动geckodriver.exe ,它可能是引擎的 Windows 版本,但您似乎在 Linux 上运行。

使用此链接下载 geckodriver-v0.32.0-linux64.tar.gz 文件

from selenium import webdriver
from selenium.webdriver import FirefoxOptions

opts = FirefoxOptions()
opts.add_argument("--headless")
browser = webdriver.Firefox(options=opts)

尝试使用selenium ~=4.4.0来删除可执行文件依赖

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM