PhantomJS() not running in pyCharm

梦想的初衷 提交于 2019-12-08 08:56:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/42464924/phantomjs-not-running-in-pycharm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!