Selenium / PhantomJS soulève une erreur
Je suis en train de lancer PhantomJS pilote dans Python mais j'obtiens une erreur. J'ai lu que je dois passer tout le chemin comme un argument, mais il n'a pas aidé.
Voici le code:
from selenium import webdriver
# driver = webdriver.Chrome('D:\Python_projects\chromedriver_win32/chromedriver.exe') # this works
driver = webdriver.PhantomJS(executable_path='D:\Python\phantomjs-2.0.0-windows\bin\phantomjs.exe')
ERREUR:
Traceback (most recent call last):
File "path to script", line 8, in <module>
driver = webdriver.PhantomJS(executable_path='D:\Python\phantomjs-2.0.0-windows\bin\phantomjs.exe')
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 50, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\service.py", line 75, in start
raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
selenium.common.exceptions.WebDriverException: Message: Unable to start phantomjs with ghostdriver.
Screenshot: available via screen
Savez-vous ce que je fais mal?
source d'informationauteur Milano Slesarik | 2015-04-25
Vous devez vous connecter pour publier un commentaire.
Faire le chemin dans la chaîne brute, ajouter 'r':
Pour des raisons de simplicité placez le fichier exécutable dans le même répertoire que votre script:
Pour moi aucun des ci-dessus ont résolu le problème; j'ai trouvé le code:
Ne fonctionne que pour les racines...