WindowsMaker
WindowsMaker

Reputation: 3400

protractor leaves behind a chromedriver.exe

I have some protractor tests running on windows 10. Every time I launch the tests, a new chromedriver gets started but it never goes away and keep piling up in the task manager. Why's that? Whom should I file the bug on? webdriver, protractor, or selenium?

This happens even with an empty config/test

Only conf I have is

exports.config = {
    framework: "jasmine",
    plugins: [],
    jasmineNodeOpts: {
        defaultTimeoutInterval: 120000
    },

    beforeLaunch: function() {
    },

    onPrepare: function() {
    },

    afterLaunch: function(exitCode) {
    },

    capabilities: { 
        "browserName": "chrome"
    },

    suites: {
        example: "spec.js",
    }
}

and the spec.js is essentially an empty test

called using "test": "protractor tests/conf.js" inside the package.json through npm

Upvotes: 5

Views: 1512

Answers (1)

Claudinha Menezes
Claudinha Menezes

Reputation: 66

I created a bat file with the commands to kill the chromedriver like below.

@echo off

taskkill /f /t /im chromedriver_2.38.exe

exit

At the protractor.config.js I used the beforeLaunch() method and in each execution, it will verify if there's some chromedriver instantiated and I can use only one instance.

For execute the bat file I used child_process. https://nodejs.org/api/child_process.html#

The code on protractor.config below:

const { exec } = require('child_process');

beforeLaunch() {
        exec('endchromedriver.bat');
}

Upvotes: 1

Related Questions