Over a million developers have joined DZone.

Any Advantages of Using taskkill.exe Over the Close Method in Selenium?

DZone's Guide to

Any Advantages of Using taskkill.exe Over the Close Method in Selenium?

Learn more about one tester's thoughts on using taskkill.exe over the close method in Selenium.

· Performance Zone ·
Free Resource

SignalFx is the only real-time cloud monitoring platform for infrastructure, microservices, and applications. The platform collects metrics and traces across every component in your cloud environment, replacing traditional point tools with a single integrated solution that works across the stack.

Q: When getting rid of a browser, what are the advantages of using taskkill.exe over the close method in Selenium?

A: I can’t really think of any advantages to using taskkill.exe over a close or quit method in Selenium.

If the browser was opened by Selenium, then I would try to have Selenium close it.

If the browser is unresponsive after executing Selenium code, then it may suggest a problem with the application under test, making the browser unresponsive, which would imply issues with the application that need to be investigated.

Another issue might be caused potentially by a mismatch between the driver version and the browser version, so the environment used to execute the code from may need to be investigated.

TaskKill.exe would make your Selenium code dependent on a Windows environment and would likely prevent you from running your Selenium execution through a local grid or a cloud grid.

If I was working on a project and saw that the code was using TaskKill.exe to close browsers, I would be investigating:

  • What happens if you just use close or quit, i.e. is it really necessary?
  • Why do people think this is necessary? Then, I would explain some of the risks and issues I mentioned above
  • If it is necessary, because quit or close do not terminate the browser session, then what changes do we have to make to our application or environment so that it is not necessary.

You should not really have to use taskkill.exe to close Selenium WebDriver initiated sessions.

Taskkill, or any process termination command, may be necessary if you using it as a temporary workaround because you are experiencing any of the issues I mentioned above. But it should really only exist as a temporary measure until you solve the problem that is causing the close or quit command to not terminate the browser.

SignalFx is built on a massively scalable streaming architecture that applies advanced predictive analytics for real-time problem detection. With its NoSample™ distributed tracing capabilities, SignalFx reliably monitors all transactions across microservices, accurately identifying all anomalies. And through data-science-powered directed troubleshooting SignalFx guides the operator to find the root cause of issues in seconds.

performance ,close ,selenium ,opinion ,taskkill.exe ,quit

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}