3

Does anyone knows how to connect existing Firefox browser with Selenium? I tried Chrome way - no luck.

Launches Firefox in debugging mode:

start firefox.exe --marionette -foreground -no-remote -profile C:\FirefoxTEMP

The code I wrote in 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)

I guess it's a problem with launching debugging mode. On Chrome I can do it with a command and a port:

chrome.exe --remote-debugging-port=9223 --user-data-dir="C:\selenum\ChromeProfile"
  • In `selenium==4.8.0`, there is `selenium.webdriver.firefox.options.Options` doesn't have an `add_experimental_option()` method. – akaihola Mar 04 '23 at 22:24

1 Answers1

1

Update. Better way to open Firefox in debugging mode (defaults to port 6000):

firefox.exe --start-debugger-server --profile C:\FirefoxTEMP
Bob
  • 689
  • 10
  • 11