WebDriverException: Message: 'phantomjs' executable needs to be in PATH

0

I'm trying to run a program that uses the selenium library and it throws me the following error:

Traceback (most recent call last):
  File "C:\Python34\prueba_nuevo_bot.py", line 2, in <module>
    bot=FacebookBot()
  File "C:\Python34\FacebookWebBot.py", line 115, in __init__
    webdriver.PhantomJS.__init__(self, desired_capabilities=dcap)
  File "C:\Python34\selenium\webdriver\phantomjs\webdriver.py", line 53, in __init__
    self.service.start()
  File "C:\Python34\selenium\webdriver\common\service.py", line 84, in start
    os.path.basename(self.path), self.start_error_message)
WebDriverException: Message: 'phantomjs' executable needs to be in PATH. 

I have the file phantomjs.exe in the folder C: \ DriverPath \ Bin \ but when I print self.path to see where it is looking for that file the path it prints is with that point instead of the bar and the" B ". How can this error be fixed, what does that faulty path mean?

    
asked by Pablo 29.06.2017 в 14:45
source

1 answer

0

I solved it like this, in the C: \ Python34 \ lib \ site-packages \ selenium-3.4.2-py3.4.egg \ selenium \ webdriver \ common \ service.py library and modify the line after the try to who is now

 def start(self):

>         """
>         Starts the Service.
> 
>         :Exceptions:
>          - WebDriverException : Raised either when it can't start the service
>            or when it can't connect to the service
>         """
>         try:
> 
>             self.path = "C:\DriverPath\Bin\phantomjs"
    
answered by 10.07.2017 / 14:10
source