Selenium «не предоставлена ​​возможность 'moz:firefoxOptions.binary', и в командной строке не установлен двоичный флаг»Python

Программы на Python
Anonymous
Selenium «не предоставлена ​​возможность 'moz:firefoxOptions.binary', и в командной строке не установлен двоичный флаг»

Сообщение Anonymous »

Я пытаюсь перенести скрипт Python в свой центр кодирования wsl/bash.
Я продолжаю получать эту ошибку:

Код: Выделить всё

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
Я искал здесь, на StackOverflow, а также в других местах и ​​нашел ответы, которые не помогли моей проблеме. Я убедился, что на моем компьютере установлен Firefox, а исполняемый файл находится в моем PATH, но он все равно выдает эту ошибку.
Вот мой код, который, по моему мнению, вызывает проблему.< /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

Вернуться в «Python»