Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k 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 (62.9k 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.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...