Le sélénium aide de Python - Geckodriver exécutable doit être dans le CHEMIN d'accès

Je suis nouveau en programmation et a commencé avec Python environ 2 mois et je suis aller sur Sweigart de Automatiser les Trucs Ennuyeux avec Python texte. Je suis en utilisant le RALENTI et déjà installé le sélénium module et le navigateur Firefox.
Chaque fois que j'ai essayé d'exécuter le webdriver fonction, j'obtiens ceci:

from selenium import webdriver
browser = webdriver.Firefox()

Exception :-

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000249C0DA1080>>
Traceback (most recent call last):
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000249C0E08128>>
Traceback (most recent call last):
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
Traceback (most recent call last):
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Python\Python35\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Python\Python35\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
browser = webdriver.Firefox()
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
self.service.start()
File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Je pense que j'ai besoin de définir le chemin d'accès pour geckodriver mais vous ne savez pas comment faire, si quelqu'un peut me dire comment faire?

  • S'il vous plaît, voir ma réponse sur la question similaire, ici
  • Je suis en train de mettre la geckodriver.exe en Python/Python35 répertoire elle a donc le même chemin et je me fais encore plus de problèmes.
  • Sur Mac: brew install geckodriver
  • J'ai trouvé que la course à travers le navigateur google Chrome est un peu plus rapide que sur Firefox, il vous suffit de télécharger le chromedriver pour cela.
  • Remarque: il y a Testcafe qui a obtenu open-source récemment. Il ne nécessite pas de plug-ins de navigateur, ils sont conçus. Je voulais utiliser le Sélénium, mais qui ressemble à une alternative intéressante.
  • découvrez lien suivant pour solution

InformationsquelleAutor tadm123 | 2016-10-23