Can I get the gecko driver to launch in an existing Firefox window?

80 Views Asked by At

I'm trying to use Selenium in Python to fill out a form, which is why I need it to run in an existing Firefox window where I'm logged in due to the sensitive login data. But I can't seem to find a way to prevent the driver launching in a new window where I am logged out. Is there a way to do this?

I've tried using options to set preference:

`from selenium.webdriver.firefox.options import Options

options = Options() options.set_preference("browser.tabs.loadInBackground", False) driver = webdriver.Firefox(options=options)`

I also tried using the -no-remote command on Firefox in cmd before running the script, but it didn't work either.

1

There are 1 best solutions below

1
Saad Jameel On

From chrome driver you can achieve this.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("user-data-dir=C:/Users/Designer1/AppData/Local/Google/Chrome/User Data/Profile 1")
driver = webdriver.Chrome(chrome_options=options,executable_path="C:\webdrivers\chromedriver.exe")