0 votes
1 view
in Devops and Agile by (16.1k points)

I initiated and close phantomjs in Python with the following

from selenium import webdriver    

driver = webdriver.PhantomJS()

driver.get(url)

html_doc = driver.page_source

driver.close()

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

How should I close the driver?

1 Answer

0 votes
by (44k points)

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.

...