V
V
Vitaly2020-02-13 03:03:25
linux
Vitaly, 2020-02-13 03:03:25

Why doesn't chromium driver terminate process after browser is closed in Selenium?

I am using selenium and chromedriver.
The parser runs every 2 minutes. I initialize the browser on every launch

browser = webdriver.Chrome(chrome_options=chrome_options,
executable_path=webdriver_path)

I parse the data and close the browser.
browser.close()


At the end of the day, I found a bunch of hanging processes in top - there is chromium itself (headless), and a chrome driver on different ports. As a result, the processor is loaded at 100%. I had to kill the processes manually and restart the parser.
5e4491ed9fb81240926702.png
So browser.close() only closes the browser without terminating the chrome driver process? How to nail it in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Priluzkiy, 2020-02-13
@Oxyd

try:
    # do my automated tasks
except:
    pass
finally:
    driver.close()
    driver.quit()

© _

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question