I'm having some problems cleaning up some of the processes my windows form application creates.

I'm using selenium which starts a process instance of a browser and a browser driver among other things.

Selenium library provides a Quit() method which if called inside my running application works just fine at cleaning up.

My problem is, that if my app is simply closed via the rex cross I cannot call Quit().

I have tried a number of things like creating a destructor for Form1 and calling Quit there, no luck. Tryed adding the following in Form1 class...

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            driver.Quit();
        } 

And that does not seem to work either.

Basically, it seems as though Quit() only works if I call it inside the public Form1() method.

Any suggestions on what I'm missing?

Thank you for reading.

Please disregard, made simple rookie mistake not linking handler to event.

Sorry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.