Stelios
Stelios

Reputation: 119

PhantomJS() not running in pyCharm

Hi I am trying to PhantomJS() in pyCharm IDE using

from selenium import webdriver
driver = webdriver.PhantomJS()

I have also tried

driver = webdriver.PhantomJS(executable_path = "/Path")

But every time it gives me error:

selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH

But this is running absolutely fine in Python 3.6.0 Shell. I have also set the path varible correctly--"C:\PhantomJs\bin\phantomjs\".

What could be the problem in pyCharm?

Upvotes: 1

Views: 1551

Answers (1)

Stelios
Stelios

Reputation: 119

Well I figured out the problem. In the executable path instead of using C:\PhantomJs\bin\phantomjs\ I used C:/PhantomJs/bin/phantomjs/. That is reversing the slashes solves the problem.

Upvotes: 1

Related Questions