Skip to main content

Aug 30, 2013 - 1 minute read - FAQ Firefox Java selenium faq Selenium Simplified Blog WebDriver

FAQ: Why has my Firefox Selenium WebDriver Browser Not Closed

A few FAQs come up on the Start Selenium Simplified course. When they do, it usually means that I haven’t done a good enough job of making the answer visible the first time I address it.

One that crops up a lot is “Why is my browser not closing?”

Because WebDriver has two methods:

  •  .close
  • .quit

The documentation for .close says that it will close the browser if it is the last window that is closed.

For the last few Firefox releases, this does not happen.

Therefore we use .close, and .quit.

Use .quit when you know it is the last window you are working with. Or if you are working with a Driver Manager abstraction then you might want to stick the .quit in a JVM Shutdown.

I don’t know the reasons why, I haven’t spent the time investigating. But the workaround is to use .quit to finish with the driver.


You will need a Github account to comment. Or you can contact me with your comment.

I reserve the right to delete spam comments e.g. if your comment adds no value and its purpose is simply to create a backlink to another site offering training, or courses, etc.