4

I've problem after update my Chrome browser to Version 65.0.3325.162 (latest)

When my tests start after done each method in task manager there appear extra zombie Chrome process which take many resources of CPU.

Task manager

IS there any change with method driver.quit() on Chrome 65? I will add that, on previous version of Chrome browser all was OK.

I use data provider so using method quit() is necessary for correctly working on my test suite.

I use mothod terminate() to close browser after each test class.

My stuff: Windows 10 Selenium WebDriver ChromeDriver 2.36 Selenium WebDriver 2.20

@AfterClass(alwaysRun = true)
    protected void terminate() {
        if (browser != null) {
            try {
                browser.quit();
                browser = null;
            } catch (UnreachableBrowserException ex) {
                TestReporter.log(ex.getMessage());
            } catch (NoSuchSessionException noSuchSessionException) {
                TestReporter.log("Tried to quit browser with NULL session: " + noSuchSessionException.getMessage());
            }
        }

        if (application != null) {
            application = null;
        }
    }
Saganowsky
  • 103
  • 1
  • 10
  • Possible duplicate of [Selenium : How to stop geckodriver process impacting PC memory, without calling driver.quit()?](https://stackoverflow.com/questions/47999568/selenium-how-to-stop-geckodriver-process-impacting-pc-memory-without-calling) – undetected Selenium Mar 16 '18 at 11:59
  • Could be a bug. I found similar issue on old versions of chrome. https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3378. check in git if there is any existing ticket for your issue. – Naveen Kumar R B Mar 16 '18 at 12:06
  • I've never known a version of Chrome that didn't do this. – Bill Hileman Mar 16 '18 at 14:19
  • it worked for me with below solution – sarath Feb 05 '19 at 21:44

2 Answers2

1

Update to new version of Chrome browser resolved my problem. It seems that Chrome 65.0.3325.162 had issue, which caused creation many zombie Chrome processes.

Saganowsky
  • 103
  • 1
  • 10
-1

1) Get the driver as singleton

@Singleton
class BrowserInstance {

ChromeDriver getDriver(){
    ChromeOptions options = new ChromeOptions()
    options.addArguments("--headless --disable-gpu")
    return new ChromeDriver(options)
   }
}

2) Use Close and quit in finally block

finally {
        chromeDriver.close()
        chromeDriver.quit()
    }

Result: you will be using only one instance at time and if you see task manager you will not find chromedriver and chrome process hanging.

sarath
  • 449
  • 4
  • 9