CptNemo CptNemo - 1 year ago 317
Python Question

How to properly stop phantomjs execution

I initiated and close

in Python with the following

from selenium import webdriver
driver = webdriver.PhantomJS()
html_doc = driver.page_source

yet after the script ends execution I still find an instance of
in my Mac Activity Monitor. And actually every time I run the script a new process
is created.

How should I close the driver?

Answer Source

The .close() method is not guaranteed to release all resources associated with a driver instance. Note that these resources include, but may not be limited to, the driver executable (PhantomJS, in this case). The .quit() method is designed to free all resources of a driver, including exiting the executable process.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download