Я продолжаю получать эту ошибку:
Код: Выделить всё
Traceback (most recent call last):
File "/path/to/my/file.py", line 20, in
driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()))
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/firefox/webdriver.py", line 177, in __init__
super().__init__(
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 270, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 363, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 428, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
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
Вот мой код, который, по моему мнению, вызывает проблему.< /p>
Код: Выделить всё
options = Options()
options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'
options.set_preference('dom.webnotifications.enabled', False)
options.headless = True
driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()))
Подробнее здесь: https://stackoverflow.com/questions/737 ... inary-flag