Protractor 留下了 chromedriver.exe

Win*_*ker 5 selenium webdriver protractor

我在 Windows 10 上运行了一些量角器测试。每次启动测试时,chromedriver都会启动一个新的测试,但它永远不会消失并不断堆积在任务管理器中。为什么?我应该向谁提交错误?webdriver、量角器还是selenium?

即使配置/测试为空也会发生这种情况

只有conf我有的是

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

    beforeLaunch: function() {
    },

    onPrepare: function() {
    },

    afterLaunch: function(exitCode) {
    },

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

    suites: {
        example: "spec.js",
    }
}
Run Code Online (Sandbox Code Playgroud)

spec.js本质上是一个空测试

"test": "protractor tests/conf.js"通过 npm 在 package.json 内部调用 using

小智 1

我创建了一个 bat 文件,其中包含杀死 chromedriver 的命令,如下所示。

@回声关闭

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

出口

在 protractor.config.js 中,我使用了 beforeLaunch() 方法,并且在每次执行中,它将验证是否实例化了一些 chromedriver,并且我只能使用一个实例。

为了执行 bat 文件,我使用了 child_process。https://nodejs.org/api/child_process.html#

protractor.config 上的代码如下:

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

beforeLaunch() {
        exec('endchromedriver.bat');
}
Run Code Online (Sandbox Code Playgroud)