c#, Microsoft.Edge.SeleniumTools: How to kill intances of both EdgeOptions and EdgeDriver.

moondaddy 916 Reputation points
2021-02-19T22:16:29.71+00:00

I have a WPF app (.net 4.8) which uses the Microsoft.Edge.SeleniumTools. Everything is working OK, but when the user closes the wpf app, and re-opens it again, it will new instances of msedgedriver.exe and the edge browser even though the previous instances are still running. So here's the situation: when running the app there are instance of 3 things running:

1) the app
2) EdgeDriver (v 3.141.0)
3) Edge browser (v 3.141.0)

When the app is closed/terminated, the EdgeDriver and Edge browser are still running. So we need to either do 1 of 2 things:

1) some clean up as the app shuts down
or
2) re-use the running instances of EdgeDriver and Edge browser

Which is the best option and i don't know how to do either one. If anyone can help - that would be great.

Thank you.

Microsoft Edge | Microsoft Edge development
Developer technologies | C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-02-22T07:50:41.947+00:00

    @moondaddy ,
    I suggest you try to call webDriver.quit() method after you finish the automation work.

    webDriver.quit() used to call the /shutdown endpoint and subsequently the WebDriver and WebBrowser instances are destroyed gracefully closing all the pages/tabs/windows.

    Example:

    70545-254.png

    ----------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.