Can't launch my url in Selenium-controlled Firefox browser process
Receiving this error: Firefox is already running, but is not responding. The old Firefox process must be closed to open a new window.
My desktop app redirects user to a login screen on Firefox, and I want to automate it using Selenium. My current workflow: 1. Launch Selenium-controlled Firefox browser using GeckoDriver 2. Click on "Login" button on my desktop app. The desktop app launches the login screen on user's OS default browser using the default user profile (in which case I set in profiles.ini to the temp profile copy created by Selenium). 3. (ERROR) Popup on the above error is displayed
Code: import configparser import os
web_driver = selenium_webdriver.Firefox(executable_path='C:\\Users\\mnxl\\.wdm\\drivers\\geckodriver\\win64\\v0.34.0\\geckodriver') profile = web_driver.capabilities['moz:profile']
- Path to the Firefox profiles folder
profiles_path = os.path.expanduser(r'~\AppData\Roaming\Mozilla\Firefox')
- Path to the profiles.ini file
profiles_ini_path = os.path.join(profiles_path, 'profiles.ini')
- Read the profiles.ini file
config = configparser.ConfigParser() config.read(profiles_ini_path)
- Find the section for the profile to set as default
for section in config.sections():
if config.has_option(section, 'Path') and config.get(section, 'Path') == profile: # Set this profile as the default config.set(section, 'Default', '1') else: # Set all other profiles as not default config.set(section, 'Default', '0')
- Write the changes back to the profiles.ini file
with open(profiles_ini_path, 'w') as configfile:
config.write(configfile)