I am using the below code to launch firefox browser, and then to connect to existing firefox browser
The problem is the control remains at
firefox_driver = webdriver.Firefox(service=service, options=custom_firefox_options)
until the driver gets timeout
The driver gets created as I can see firefox running with automation sign, the control get stuck and does not move forward
I want to connect to existing firefox browser as I am using some desktop automation that clicks on links that need to be open in existing selenium automated browsers, instead of a new window
def create_firefox_driver() -> webdriver:
firefox_driver = None
binary_path = 'C:\\Program Files\\Mozilla Firefox\\firefox.exe'
command = [
binary_path,
'--marionette',
]
subprocess.Popen(command, shell=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
custom_firefox_options = // some options
executable_path = GeckoDriverManager().install()
service = FirefoxService(
executable_path=executable_path,
service_args=['--marionette-port=2828', '--connect-existing']
)
firefox_driver = webdriver.Firefox(service=service, options=custom_firefox_options)
return firefox_driver```