Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 碎片(幻影)投掷错误_Python_Selenium_Splinter - Fatal编程技术网

Python 碎片(幻影)投掷错误

Python 碎片(幻影)投掷错误,python,selenium,splinter,Python,Selenium,Splinter,我在运行Splinter脚本时遇到此错误 错误: Exception AttributeError: AttributeError("'NoneType' object has no attribute 'close'",) in <bound method Service.__del__ of <selenium.webdriver.phantomjs.service.Service object at 0x7fa709da3fd0>> ignored 我还尝试在末

我在运行Splinter脚本时遇到此错误

错误:

Exception AttributeError: AttributeError("'NoneType' object has no attribute 'close'",)
in <bound method Service.__del__ of 
<selenium.webdriver.phantomjs.service.Service object at 0x7fa709da3fd0>> ignored

我还尝试在末尾添加
browser.driver.close()
,但这并没有解决问题浏览器窗口是否打开并显示?如果是,那么您可能只需要不同版本的phantomjs可执行文件(假定您在Windows上运行,则为phantomjs.exe)。
一般来说,关闭消息并不奇怪,因为在程序结束时,浏览器会暗示关闭。这可能是splinter版本与路径中的phantomjs可执行文件之间的兼容性问题。
尽管这可能不是您的问题,但您确实需要在路径中有一个单独的phantomjs可执行文件。您可以在“phantomjs下载”上搜索以了解更多信息。

如果不确定无头浏览器是否正在打开,可以向代码中添加一条简单的打印语句,如
print(browser.html)

以查看命令提示窗口中发生的情况。

浏览器窗口是否打开并显示?如果是,那么您可能只需要不同版本的phantomjs可执行文件(假定您在Windows上运行,则为phantomjs.exe)。
一般来说,关闭消息并不奇怪,因为在程序结束时,浏览器会暗示关闭。这可能是splinter版本与路径中的phantomjs可执行文件之间的兼容性问题。
尽管这可能不是您的问题,但您确实需要在路径中有一个单独的phantomjs可执行文件。您可以在“phantomjs下载”上搜索以了解更多信息。
如果不确定无头浏览器是否正在打开,可以向代码中添加一条简单的打印语句,如
print(browser.html)

,以查看命令提示窗口中发生的情况

 from splinter import Browser

 browser = Browser('phantomjs')
 browser.visit('https://example.com/')