Home>

Error when trying to scrape with selenium and firefox using pyCharm

First, I installed selenium. Next, I tried to install firefox, but there was only a module named selenium-firefox, so I installed it.

Next, I downloaded geckodriver from a browser, unzipped it, and moved it to a location in my PATH.

And here's the code I want to execute: path is entered correctly

driver = Firefox (executable_path ='/ mypath/geckodriver')
url = "https: // url /"
options = FirefoxOptions ()
options.add_argument ('-headless')
browser = Firefox (options = options)
browser.get (url)
browser.save_screenshot ("website.png")
browser.quit ()

When you run this
selenium.common.exceptions.SessionNotCreatedException: Message: Expected browser binary location, but unable to find binary in default location, no moz: firefoxOptions.binary' capability provided, and no binary flag set on the command line
I get an error like this. It seems that firefox doesn't exist, why?
I tried various things, but I couldn't find the cause.


Please.