web-dev-qa-db-fra.com

Emplacement binaire du navigateur attendu, mais incapable de trouver du binaire en position par défaut, non 'Moz: FirefoxoptionS.binary' Capacité fournie à l'aide de GeckOriver

from Selenium import webdriver;
browser= webdriver.Firefox();
browser.get('http://www.seleniumhq.org');

Quand j'essaie d'exécuter ce code, cela me donne un error 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.

Toute pensée - très appréciée!

15
Sergii Sechka

Avant de vous assurer que la variable de chemin est incluée pour GeckOriver Cliquez ici pour télécharger le pilote et exécuter ci-dessous python Script.

from Selenium import webdriver
from Selenium.webdriver.firefox.options import Options

options = Options()
options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'
driver = webdriver.Firefox(options=options)
driver.get('http://google.com/')
0
Newton Sathyavety