繁体   English   中英

Python : Selenium 不启动 firefox 浏览器

[英]Python : Selenium does not start the firefox browser

尝试通过webdriver运行firefox,但是firefox不运行。 正确指定所有内容(firefox 路径),即使什么也没发生。 我将衷心感谢您的帮助。

[*]geckodriver.exe 被移动到 /usr/bin

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary("C:\Program Files\Mozilla Firefox\Firefox.exe")#path of Firefox.exe
driver = webdriver.Firefox(firefox_binary=binary)
driver.get("https://google.com")

您必须将驱动程序放在 PATH 中,或者您可以指定驱动程序的路径。

driver = webdriver.Firefox(executable_path="path\to\geckodriver.exe")

如果你还没有,你可以从这里下载它并把它放在你的python文件夹中。

暂无
暂无

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

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