似乎这个bug在Phantom JS版本2.48中出现过,但我不明白为什么它出现在旧版本(稳定版本)中正在使用。无法退出PhantomJS,windows 7. Phantom JS版本2.1.1
这是一个非常类似的问题。
How to properly stop phantomjs execution
但这里是我的代码,并且错误它抛出
from selenium import webdriver
driver = webdriver.PhantomJS() # or add to your PATH
driver.set_window_size(1024, 768) # optional
driver.get('https://google.com/')
driver.close()
driver.quit()
伊夫单独和共同使用这两种.close()和.quit()。 close()似乎可以自行工作,但实际上并没有停止phantomjs进程。
driver.quit()给我的错误
Traceback (most recent call last):
File "C:\Python27\test.py", line 9, in <module>
driver.quit()
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 74, in quit
self.service.stop()
File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 124, in stop
self.process.stdout.close()
AttributeError: 'NoneType' object has no attribute 'close'
任何意见或建议将是巨大的。 谢谢!
编辑:我也尝试重新启动作为这里所说Selenium webdriver + PhantomJS processes not closing