Comment on
How do you start Selenium+Firefox on Linux using a custom Geckodriver and Firefox path?
Reply in thread
I need to scrape an internal website using the system browser via --marionette Eventually this will be turned into a windows script. I tried using webdriver-manager and got it working but I still need to specify a path to firefox and the site is internal. This is my script in Windows - it doesn't work. It uses GeckDriverManager but I'd prefer a hardcoded path.
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from webdriver_manager.firefox import GeckoDriverManager
options = Options()
options.binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox\firefox.exe')
service = Service(GeckoDriverManager().install(), service_args = ['--marionette-port', '2828', '--connect-existing'] )
driver = webdriver.Firefox(options=options, service = service)
#pageSource = driver.page_source
#print(pageSource)