Skip to main content

Dealing with Selenium WebDriver Driver.Quit crashes (Where chromedriver.exe is left open)

We recently came across a problem with Selenium not quitting the webdriver and this would then lock a file that was needed on the build server to run the builds.

We were using Driver.Quit() but this sometimes failed and would leave chromedriver.exe running. I looked around and found this was a common issue that many people were having. We (I say we, as we came to the solution through paired programming), came up with the following, that would encapsulate the driver.quit inside a task and if this task takes longer than 10 seconds, then it will clean up any processes started by the current process, in the case of the issue on the build server, it would kill any process started by Nunit.

[AfterTestRun]
        public static void AfterTestRun()
        {
            var nativeDriverQuit = Task.Factory.StartNew(() => Driver.Quit());
            if (!nativeDriverQuit.Wait(TimeSpan.FromSeconds(10)))
            {
                CleanUpProcessByInheritance();
            }
       }

        private static void CleanUpProcessByInheritance()
        {
            var currentProcessPid = Process.GetCurrentProcess().Id;
            foreach (var process in Process.GetProcesses())
            {
                using (var mo = new ManagementObject("win32_process.handle='" + process.Id.ToString(CultureInfo.InvariantCulture) + "'"))
                {
                    mo.Get();
                    var parentPid = Convert.ToInt32(mo["ParentProcessId"]);

                    if (parentPid == currentProcessPid)
                    {
                        process.Kill();
                    }
                }
            }
        }

I've read quite a bit around this subject and it seems to be a common issue, that the driver.quit can leave the chromedriver.exe open, hence the need for the above method. Since implementing this fix we've not seen the locked file anymore on the build server, so hopefully it's solved. If not then I'll be sure to update this blog with (hopefully) a new workaround.

Comments

  1. really the way of explanation about selenium concept was so superb.. Software Testing Training in Chennai | Selenium Training in Chennai

    ReplyDelete
  2. Awesome blog with informative content. Thank you for blogging such a excellent blog. Dot Net Training in Chennai | Java Training in Chennai

    ReplyDelete
  3. Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me...
    Software Testing Training in Bangalore
    AWS Training in Chennai

    ReplyDelete
  4. Thanks for your informative post. Your article helped me a lot to understand the future..Web Designing Training Institutes in Chennai | Web Designing Training Institutes in Velachery.

    ReplyDelete
  5. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
    selenium training in bangalore|
    python training in bangalore|

    ReplyDelete
  6. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!

    data science training in bangalore

    ReplyDelete
  7. I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
    "Devops Training in Chennai"

    ReplyDelete

  8. The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
    office 2010 professional plus key deutsch

    ReplyDelete
  9. It is really a great work and the way in which you are sharing the knowledge is excellent.Thanks for your informative article

    selenium training in chennai|

    ReplyDelete
    Replies
    1. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

      Java Training In Bangalore

      Delete
  10. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site."Devops Training in Bangalore"

    ReplyDelete
  11. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    Besant technologies Marathahalli

    ReplyDelete
  12. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!

    Data Science Training in Bangalore

    ReplyDelete
  13. The best thing is that your blog really informative thanks for your great information..Final Year Projects Center in Chennai | Final Year Projects Center in Velachery

    ReplyDelete
  14. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
    Power System Project Center in Chennai | Power System Project Center in Velachery

    ReplyDelete
  15. Thanks for your informative article. Your post helped me to understand the future and career prospects. Keep on updating your blog with such awesome article.
    Android Project Center in Chennai | Android Project Center in Velachery

    ReplyDelete
  16. Great tips and its so easy to understand. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog. RPA Training Institute in Chennai | UI Path Training Institute in Chennai | Blue Prism Training Institute in Chennai

    ReplyDelete
  17. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Final Year Project Center in Chennai | Final Year Project Center in Velachery

    ReplyDelete
  18. Awesome blog, you explain everything in detailed manner, it was very interesting to read. Thanks for sharing such an informative blog. Automation Anywhere Training in Chennai | RPA Training Institute in Chennai | UI Path Training Institute in Chennai

    ReplyDelete
  19. Really Great blog about Selenium Wed Drive and Very good explanation. Thank you , keep updating regularly.

    NO.1 CLOUD SERVICES | Oracle Cloud PAAS | MASSIL TECHNOLOGIES

    ReplyDelete
  20. Useful and very informative post. Could you update your upcoming post related selenium and other software testing course.?

    Here few course details
    Big data training in Chennai

    ReplyDelete
  21. Thanks for the useful information of software testing courses, give more updates on software testing development.

    software testing training

    ReplyDelete
  22. You truly did more than visitors’ expectations. Thank you for rendering these helpful, trusted, edifying and also cool thoughts on the topic to Kate. Selenium Training In Bangalore | Best Selenium Training in Bangalore

    ReplyDelete
  23. t's interesting that many of the bloggers to helped clarify a few things for me as well please go for DevOps Training call +91- 9999201478.

    ReplyDelete
  24. It is extremely an extraordinary work and the manner by which you are sharing the learning is excellent.Thanks for your educational article.
    Read Beard Press

    ReplyDelete
  25. It is a one of the great discussion which is very essential for me as well. I must follow the handy discussion and sure that the content will be very useful to me as well. Keep it up.
    Tata Sky New Connection | Tata Sky DTH | Tata Sky DTH New Connection

    ReplyDelete
  26. This is very good blog for learners, Thanks for sharing valuable information...DotNet Project Center in Chennai | DotNet Project Center in Velachery

    ReplyDelete
  27. Really Very Informative Blog.Just Simply cleared All my doubts through your post.Very happy For sharing,Coming to Ourself We Are the leading Providers for Restaurant Parts In Us.Really Thanks For Sharing Such an Informartive Post.

    ReplyDelete
  28. This blog will get more thoughts. This is exceptionally useful for Software Testing students. Much thanks to you for sharing this great site.
    Selenium Training in Chennai | Selenium Course in Chennai | Selenium Training Institute in Chennai| Selenium Training Chennai

    ReplyDelete
  29. Excellent blog with useful concept. Really I feel very happy to see this informative...PHP Project Center in Chennai | PHP Project Center in Velachery

    ReplyDelete
  30. Great post! Thanks for sharing this valuable information.

    Selenium Training in Chennai

    ReplyDelete
  31. I feel really happy to have seen your webpage and look forward to so
    many more entertaining times reading here. Thanks once more for all
    the details.

    hadoop training in chennai

    ReplyDelete
  32. Thanks For Sharing Valuable Information, Very Useful For U Medical Residency in USA

    ReplyDelete
  33. Great blog! Thanks for giving such valuable information, this is unique one. Really admired.

    Selenium Training in Chennai | QTP Training in Chennai

    ReplyDelete
  34. Thanks for sharing this useful post.It was really helpful for me.Keep it up. I am waiting for your next blog. Warehouse Audit | Visibility Audit | Inventory Audit

    ReplyDelete
  35. I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post.

    selenium training in chennai

    ReplyDelete
  36. Thanks for giving a great information about dealing-with-driverquit-crashes Good Explination nice Article
    anyone want to learn advance devops tools or devops online training
    DevOps Online Training contact Us: 9704455959

    ReplyDelete
  37. Really Thanks For Sharing Such an Informative Post and also thanks for posting

    24Layouts

    ReplyDelete
  38. This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.Your final conclusion was good.
    Hadoop Training adyar
    Hadoop Training in adyar
    Big Data Training in adyar
    Selenium Training in Chennai
    iOS Training in Chennai
    Loadrunner Training in Chennai

    ReplyDelete
  39. Hi admin...your blog was interesting.All the Details were explained in clear manner. Thanks for sharing this blog. Duplicate Payment Audit
    Duplicate Invoice Audit | AP Vendor Helpdesk

    ReplyDelete
  40. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing..
    best big data training in chennai
    Big Data Hadoop Training
    Hadoop training institutes in chennai
    hadoop big data training in chennai
    big data training institute in chennai
    Best Hadoop Training in Chennai

    ReplyDelete
  41. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    Selenium Training in Chennai

    ReplyDelete
  42. Thanks for your sharing such a useful information. this was really helpful to me.

    Education
    Technology

    ReplyDelete
  43. Super and Nice Blog with bunch of Real Time Examples.............

    selenium training in chennai

    ReplyDelete
  44. I think things like this are really interesting. I absolutely love to find unique places like this. It really looks super creepy though!! Machine learning training in chennai
    python machine learning training in chennai
    artificial intelligence and machine learning course in chennai

    ReplyDelete
  45. InstantPcApps
    It's a hub for free mac, pc, android and ios software. You can get any kind of game, software and mobile application free of cost. ByteFence Anti-Malware Pro Crack With Activation key

    ReplyDelete
  46. InstantPcApps
    It's a hub for free mac, pc, android and ios software. You can get any kind of game, software and mobile application free of cost. Magix Music Maker 2018 Crack With Serial Key

    ReplyDelete
  47. Torrentsformac
    A free download hub to activate, crack your softwares for windows and you mac. you can download keygen, generator and activators to crack your desired Guitar Pro Crack With Product Key

    ReplyDelete
  48. Keep up the great work, I read few blog posts on this site and I believe that your website is really interesting and has loads of good info.


    Selenium Training in Chennai
    Selenium Training
    iOS Training in Chennai
    French Classes in Chennai
    Big Data Training in Chennai
    iOS Training Institute in Chennai

    ReplyDelete
  49. This is really too useful and have more ideas and keep sharing many techniques. Eagerly waiting for your new blog keep doing more.
    JAVA Training in Chennai
    Java Training
    Digital Marketing Course in Chennai
    Hadoop Training in Chennai
    Android Training in Chennai

    ReplyDelete
  50. Thanks for the marvelous posting! I quite enjoyed reading it, you can be a great author.I will ensure that I bookmark your post and will often come back down the road. I want to encourage one to continue your great job, have a nice evening! website seo services

    ReplyDelete
  51. My wife and i were quite peaceful when Albert managed to finish up his basic research through the precious recommendations he was given out of the web pages. It is now and again perplexing just to always be giving away instructions which other folks have been making money from. We really remember we need you to give thanks to for this. The illustrations you have made, the straightforward blog navigation, the friendships your site help engender - it's got most unbelievable, and it's really leading our son in addition to us feel that this situation is cool, and that's extraordinarily important. Thanks for the whole thing!search engine marketing services

    ReplyDelete
  52. Great blog. The information you provide were useful. Keep updating this for more information.
    Selenium Webdriver Training Online

    ReplyDelete
  53. I just could not depart your site before suggesting that I really enjoyed the standard information a person provide for your visitors? Is going to be back often in order to check up on new posts singapore truck

    ReplyDelete
  54. Very Clear Explanation. Thank you to share this. I am waiting for your new blog posting..Keep posting..
    Regards,
    Best Devops Training in Chennai | Best Devops Training Institute in Chennai

    ReplyDelete
  55. I have to voice my gratitude for your generosity supporting women who really want help on this important question. Your very own dedication to passing the message across turned out to be extremely informative and has all the time empowered people like me to realize their dreams.cannabis seed bank usa

    ReplyDelete
  56. I don't know what I would have done if I hadn't come upon such a thing like this. I can at this point look forward to my future. Thank you very much for your skilled and sensible help. I will not hesitate to endorse your web sites to anyone who needs to have recommendations about this subject.wedding photography melbourne

    ReplyDelete
  57. Hello! This is kind of off topic but I need some help from an established blog. Is it tough to set up your own blog? I'm not very techincal but I can figure things out pretty fast. I'm thinking about making my own but I'm not sure where to begin. Do you have any tips or suggestions? Thanks orland park il real estate

    ReplyDelete
  58. What i don't understood is actually how you are not actually much more well-liked than you might be right now. You're so intelligent. You realize therefore significantly relating to this subject, produced me personally consider it from so many varied angles. Its like women and men aren't fascinated unless it is one thing to do with Lady gaga! Your own stuffs great. Always maintain it up! search engine marketing

    ReplyDelete
  59. Such a great article which i read before, it's a valuable suggestion to do in the process we can do.
    SEO training in chennai
    SEO course in chennai
    Digital marketing training in chennai


    ReplyDelete
  60. I believe this is one of the such a lot important information for me. And I'm glad reading your article. But should commentary on few normal issues, The web site taste is great, the articles are actually nice: D. Good task, cheers His comment is here: Eight Ways To Improve Encryption Software & Haven’t You Heard About The Recession: Top Ten Reasons Why You Should How To Encrypt A Password For Free.

    ReplyDelete
  61. This is really too useful and have more ideas and keep sharing many techniques. Eagerly waiting for your new blog keep doing more.
    Regards,
    Tableau training in Chennai | Tableau Courses Training in Chennai | Tableau training Institute in Chennai

    ReplyDelete
  62. Thanks for sharing this video! I'm loving this poem. It's true, tester's home is work with a team.
    https://qawerk.com/process/automated-testing/

    ReplyDelete
  63. I’m not sure where you are getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for fantastic info I was looking for this info for my mission. web design studio

    ReplyDelete
  64. I used to be very pleased to seek out this web-site.I wished to thanks for your time for this excellent read!! I definitely enjoying each little bit of it and I've you bookmarked to take a look at new stuff you blog post. a math tuition singapore

    ReplyDelete

Post a Comment

Popular posts from this blog

Testers: Be more like a Super-Villain!

Who doesn't love a Super Hero? Talk to my son, and he'll tell you how much he loves them, talk to many adults and they'll say the same! Deep down, we all love to be the Super Hero, we all want to save the day! However, I want to talk about the flip side of Super Heroes, the Super Villains... I often play Imaginext with my son, and I (unfortunately?) am nearly always the Super Villain! Be it Lex Luthor, Joker, Two Face, Mr Freeze or The Riddler! These are all great characters and great Super Villains, but why would I want to write about Super Villains? A while ago where I worked, we had a few Super Heroes, people who would be able to come in and "fix" things that had broken and help deliver projects on time. We then shifted, we decided to do away with the Super Hero culture and try and prevent from being in that position in the first place, whilst we didn't go as far as wanting to hire Super Villains, it's definitely a story that has stuck with me and t...

QA is Awesome!

No real point to this post other than I have had the song stuck in my head and figured I could change it slightly and quite easily make QA is Awesome! Oh and I haven't even seen the movie all the way through! But for some reason that song is incredibly catchy! Not much point to this post in fact, just thought I'd put it out there :)

Measuring QA Key Skills and Competencies

I have been thinking about how I can help encourage self improvement within my team, as I understand it, everyone wants to improve, it's just that often there are a number of things that hold people back. I believe one of these things that hold people back are around identifying skills that they are perhaps weak in or that they could/should improve on. So I thought about how I can help tackle that problem. One solution that I want to try with people is to identify the key skills for a QA, what key skills should every QA have, or at least what key skills make up a good QA? If I can identify these then I can start helping people identify if they are lacking in an area. Sure there is a competency matrix that we have, but it has things like "An excellent understanding of XXX", it's often very difficult to quantify what an excellent understanding actually is. So I sat down and came up with the following key skills: OOP Test Documentation Manual Testing Automated...