Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I set up a python code to run Selenium chromedriver.exe. At the end of the run, I have browser.close() to close the instance. (browser = webdriver.Chrome()) I believe it should release chromedriver.exe from memory (I'm on Windows 7). However, after each run, there is one chromedriver.exe instance remain in the memory. I hope there is a way I can write something in python to kill the chromedriver.exe process. Obviously browser.close() doesn't do the work. Thanks.

1 Answer

0 votes
by (62.9k points)

This answer will depict, how to properly dispose of the web-driver in C#

If you want to use a 'proper' mechanism that should be used to 'tidy up' after running ChromeDriver you should use IWebDriver.Dispose();

I usually implement IDisposable on the class that is dealing with IWebDriver

public class WebDriverController : IDisposable

{

   public IWebDriver Driver;

    public void Dispose(){

        this.Driver.Dispose();

    }

}

and use it like:

using (var controller = new WebDriverController())

{

//code goes here

}

 Hope this helps!

Browse Categories

...