Running Nightwatch without setting it to headless leaves behind Chrome Processes

1,091 views
Skip to first unread message

ChaBuku Bakke

unread,
Jun 11, 2018, 1:24:02 PM6/11/18
to NightwatchJs
Does anyone experience this issue?

In my nightwatch.conf.js file I have under test settings this:

            "desiredCapabilities": { // use Chrome as the default browser for tests
               
"browserName": "chrome",
               
"chromeOptions": {
                   
"args": [
                       
"--no-sandbox",
                       
"window-size=1366,768",
                       
"--incognito"
                       
// ,"--headless"
                   
]
               
}
           
},

When I run headless it does not leave behind extra Chrome background processes, but when I run it with that commented out (like above) it will leave behind Chrome background processes

This quickly drags my system down.

Am I missing something in my settings to remove this?

David Linse

unread,
Jun 12, 2018, 8:45:09 AM6/12/18
to nightw...@googlegroups.com
how does a test look like ?

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/f7a42d5a-2f56-4575-bdc9-9a7ba903beef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ChaBuku Bakke

unread,
Jun 12, 2018, 9:05:39 AM6/12/18
to NightwatchJs
It looks the same whether headless or not. 

It sets up, it tears down. everything seems to be fine if running headless. The console does nothing different between the two types of tests.


On Tuesday, June 12, 2018 at 8:45:09 AM UTC-4, davidlinse wrote:
how does a test look like ?
On Jun 11, 2018 7:24 PM, "ChaBuku Bakke" <cha...@gmail.com> wrote:
Does anyone experience this issue?

In my nightwatch.conf.js file I have under test settings this:

            "desiredCapabilities": { // use Chrome as the default browser for tests
               
"browserName": "chrome",
               
"chromeOptions": {
                   
"args": [
                       
"--no-sandbox",
                       
"window-size=1366,768",
                       
"--incognito"
                       
// ,"--headless"
                   
]
               
}
           
},

When I run headless it does not leave behind extra Chrome background processes, but when I run it with that commented out (like above) it will leave behind Chrome background processes

This quickly drags my system down.

Am I missing something in my settings to remove this?

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.

ChaBuku Bakke

unread,
Jul 18, 2018, 11:27:42 AM7/18/18
to NightwatchJs
I still haven't figured this out, and even in headless it leaves behind a bunch of ghost chrome processes

ChaBuku Bakke

unread,
Jul 18, 2018, 11:32:07 AM7/18/18
to NightwatchJs
This is what a test looks like:

module.exports = {
    before
: function(browser, done) {
        browser
.perform(function(){done();});
   
},
   
    beforeEach
: function (browser, done) {
       
const PreloginPage = browser.page.PreloginPage();

       
PreloginPage.navigate();
   
},

   
'Can Go To Home Page': function(browser){
       
const HomePage = browser.page.HomePage();
       
HomePage.navigate()
           
.isAt();
   
},

    after
: function(browser, done){
        browser
.end(done);
   
}
};









On Monday, June 11, 2018 at 1:24:02 PM UTC-4, ChaBuku Bakke wrote:

Nico H

unread,
Jul 18, 2018, 1:21:04 PM7/18/18
to NightwatchJs
What version of NightWatch are you on? I experienced the same issue with V0.9 but after migrated to V1 the ghost background process issue went away(and faster performance in general). If you are using an older version I recommend migrating to V1.

ChaBuku Bakke

unread,
Jul 19, 2018, 9:48:32 AM7/19/18
to NightwatchJs
I'm on 0.9.20, I'm going to try upgrading and see if that helps. What version of 1.x.x are you on? I know it's not released yet, that's why I've been hesitant to upgrade. 

Thanks

Nico H

unread,
Jul 19, 2018, 12:58:03 PM7/19/18
to NightwatchJs
I'm at v1.0.6. V1 has recently been release as BETA. Hope the upgrade resolves your issue. Before upgrading I was constantly killing the ghost processes in the terminal so my CPU didn't go crazy. 

ChaBuku Bakke

unread,
Jul 19, 2018, 3:54:01 PM7/19/18
to NightwatchJs
I upgraded to v1.0.6, but that didn't do it for me. I've spent quite a bit of time trying to figure it out to no avail.

I switched from running the chromedriver from standalone to using the Selenium server, made sure they were all up to date. Nothing seems to fix this issue. Now that I'm running the Selenium Server I notice it only happens when tests fail, so I'm looking at how I can make sure it closes even on fail.

My thought is that the after function isn't running because the test is failing, and do it never gets to my chromedriver.stop()

Nico H

unread,
Jul 19, 2018, 5:27:20 PM7/19/18
to NightwatchJs
Hmm, and you have browser.end() in your after hook?

Simon Correia

unread,
Jul 20, 2018, 2:02:54 AM7/20/18
to nightw...@googlegroups.com
Hi,

Here is what i tried and it seems to work. It kills the chromedriver.exe process after every test.

afterEach: function(browser, done) {
    // performing an async operation
    setTimeout(function() {
        // finished async duties
        done();
        browser.closeWindow();
        browser.end();
    }, 200);
}
Just add browser.closeWindow(); before browser.end();
This basically closes the browser window first than kills the process with .end()

Let me know if it worked for you all as well.

Thanks & Regards,

Simon

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

ChaBuku Bakke

unread,
Jul 20, 2018, 11:03:46 AM7/20/18
to NightwatchJs
I have tried this, and for now it seems to work in headless mode. It seemed to happen predominantly when tests were failing, but the afterEach & after should run after every test suite (when in globals.js) I think.

When a bunch of tests failed it seemed like it wasn't destroying the browser process.

As far as running without headless mode on Nightwatch leaves behind some really cpu & memory intensive processes. They each take up about 20-40% of my memory usage per test. 😲

Adding closeWindow() did not help in this one.

Still not sure what else I can change to get this to close properly without closing by hand in the Task Manager in my system.

Thanks & Regards,

Simon

To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

ChaBuku Bakke

unread,
Oct 8, 2018, 10:26:17 AM10/8/18
to NightwatchJs
Using Nightwatch without running headless still leaves tons of Chrome processes behind. Maybe one day I'll be able to fix this.


On Monday, June 11, 2018 at 1:24:02 PM UTC-4, ChaBuku Bakke wrote:
Reply all
Reply to author
Forward
0 new messages