PhantomJS()未在pyCharm中运行 [英] PhantomJS() not running in pyCharm

查看:529
本文介绍了PhantomJS()未在pyCharm中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

from selenium import webdriver
driver = webdriver.PhantomJS()

我也尝试过

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

但是,这在Python 3.6.0 Shell中运行得很好.我还正确设置了路径变量-"C:\ PhantomJs \ bin \ phantomjs \".

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

pyCharm可能是什么问题?

What could be the problem in pyCharm?

推荐答案

好,我弄清楚了这个问题. 在可执行路径中,而不是使用C:\ PhantomJs \ bin \ phantomjs \ C:/PhantomJs/bin/phantomjs/.那就是将斜线颠倒即可解决问题.

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.

这篇关于PhantomJS()未在pyCharm中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆