I am playing with selenium in Python and Firefox windows in headless mode. The problem is that I've created lots of Firefox windows in headless mode using this useful answer, if you ask me.
First of all, I don't understand why this answer earned no votes whatsoever, except for my own, even if it seems to work fine. Can someone explain? Maybe I am missing something. ¯\_(ツ)_/¯
Secondly, unfortunately, I did not close those windows running in headless mode using driver.close()
in Python code, and there are lots of them. I wonder, how can I close them all now?
The only solution I have found (for Ubuntu
and MacOS High Sierra
) is this:
ps aux | grep firefox | awk '{print $2}' | xargs kill
..., which should be run in terminal.
But it not only closes all Firefox windows in headless mode. It literally kills all the processes related to Firefox.