I'm trying to create a script which downloads a file from a website and for this I want to change the download filepath. When I try to do this with the Firefox options it gives me this error:
TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_options'
Code:
from selenium import webdriver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
import time
options = Options()
options.add_argument("download.default_directory=C:\\Music")
browser = webdriver.Firefox(firefox_options=options, executable_path=r'C:\\selenium\\geckodriver.exe')
browser.get('https://duckduckgo.com/')
The browser option parameter firefox_options was deprecated in Selenium 3.8.0
- Browser option parameters are now standardized across drivers as
options.firefox_options,chrome_options, andie_optionsare now deprecated
Instead you have to use options as follows:
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument("download.default_directory=C:\\Music")
browser = webdriver.Firefox(options=options, executable_path=r'C:\\selenium\\geckodriver.exe')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With