有谁知道如何将现有的 Firefox 浏览器与 Selenium 连接?我尝试了 Chrome 方式 - 没有运气。
在调试模式下启动 Firefox:
start firefox.exe --marionette -foreground -no-remote -profile C:\FirefoxTEMP
我用Python编写的代码:
from selenium import webdriver
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_experimental_option("debuggerAddress", "127.0.0.1:9224")
drivePath = r'C:\\geckodriver.exe'
driver = webdriver.Firefox(options= options, executable_path = drivePath)
我猜这是启动调试模式的问题。在 Chrome 上,我可以使用命令和端口来完成此操作:
chrome.exe --remote-debugging-port=9223 --user-data-dir="C:\selenum\ChromeProfile"
更新。在调试模式下打开 Firefox 的更好方法(默认端口 6000):
firefox.exe --start-debugger-server --profile C:\FirefoxTEMP
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)