有谁知道如何将现有的 Firefox 浏览器与 Selenium 连接起来?我尝试了 Chrome 方式 - 不走运。
在 Debug模式下启动 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)
我猜是启动 Debug模式的问题。在 Chrome 上,我可以使用命令和端口来完成:
chrome.exe --remote-debugging-port=9223 --user-data-dir="C:\selenum\ChromeProfile"
最佳答案
更新。在 Debug模式下打开 Firefox 的更好方法(默认端口 6000):
firefox.exe --start-debugger-server --profile C:\FirefoxTEMP
关于python - 如何将 Selenium 连接到现有的 Firefox 浏览器? (Python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66154886/