![](/img/trans.png)
[英]How to connect to an existing firefox instance using selenium(python)
[英]How to connect Selenium to existing Firefox browser? (Python)
有誰知道如何將現有的 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 的更好方法:
start firefox.exe --start-debugger-server 9224 -profile C:\FirefoxTEMP
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.