0

I'm using a script which runs with Python 3.4 and the selenium library, and I'm getting this error

PhantomJS with Selenium error: Message: 'phantomjs' executable needs to be in PATH

which has a solution here

PhantomJS with Selenium error: Message: 'phantomjs' executable needs to be in PATH

but when I try to implement the solution the path to C:\DriverPath\Bin\ is wrongly brought, when I print the property which has it (self.path), it prints

enter image description here

with that dot over there instead of C:\DriverPath\Bin\ and it keeps triggering "PhantomJS with Selenium error: Message: 'phantomjs' executable needs to be in PATH" . Any idea what could it be

Pablo
  • 4,821
  • 12
  • 52
  • 82
  • 2
    I assume, this is window's way of rendering `\b`. When setting paths in python, either escape backslashes (i.e. `"C:\\DriverPath\\Bin\\"`) or use raw strings (i.e. `r"C:\DriverPath\Bin\"`). – Dave J Jun 30 '17 at 13:12

1 Answers1

1

Working with Selenium 3.4.3 & PhantomJS 2.1.1 with Python 3.6.1 the following lines of code initializes the PhantomJS Driver perfecto:

driver = webdriver.PhantomJS(executable_path="C:\\Utility\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe")
driver.get("https://www.booking.com/")

Let me know if this Answers your Question.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352