Reputation: 1493
Seems this bug came up briefly during Phantom JS version 2.48 from what I've seen, but I dont understand why it is present in the older (stable) version I am using.
Here is a very similar question.
How to properly stop phantomjs execution
However here is my code, and the error it throws
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()
Ive used both .close() and .quit() individually and together. close() seems to work by itself, but does not actually stop the phantomjs process.
driver.quit() gives me the error
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'
Any ideas or suggestions would be great. Thanks!
edit: I have also tried a reboot as stated here Selenium webdriver + PhantomJS processes not closing
Upvotes: 0
Views: 255
Reputation: 3538
Suggestion: check service.py patch:
https://github.com/SeleniumHQ/selenium/issues/1854
https://github.com/SeleniumHQ/selenium/commit/e85c59460b7292046f377b405882454c77458b96
Upvotes: 1