Most of my articles are about WebDriver. Today, I am going to write about a common problem that people usually hit. Have you experienced this? Your tests finish and then all of a sudden, the browser is still opened? The next time you try to clean the build folder, you cannot because the current driver’s EXE is still in use. Such a pity. From now on, your builds start failing. Many people complain about the flakiness of WebDriver, and this is one of the reasons. Here, I am going to propose to you a solution: As they say in Mortal Kombat, “Finish Him!" (kill all of the processes).
Test C# Code
Once again, I will use one of my favorite test pages: Bing. Below, you can find the page object that we will use in the tests.