Selenium 在Gulp中自动运行e2e测试的webdriver

Selenium 在Gulp中自动运行e2e测试的webdriver,selenium,selenium-webdriver,gulp,protractor,e2e-testing,Selenium,Selenium Webdriver,Gulp,Protractor,E2e Testing,这里有以下dragrator.conf.js: exports.config = { framework: 'jasmine', specs: ['e2e-tests/**/*.js'], seleniumAddress: 'http://127.0.0.1:4444/wd/hub', seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar' } 吞

这里有以下dragrator.conf.js:

exports.config = {
  framework: 'jasmine',
  specs: ['e2e-tests/**/*.js'],
  seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
  seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar'
}
吞咽任务:

gulp.task('e2e-testing', ['webdriver_standalone'], function() {
  gulp.src([]).pipe(protractor({ configFile: "protractor.conf.js" }))
    .on('error', function(e) { throw e })
});

这段代码运行良好,但在启动
e2e
任务之前,我必须执行
webdriver manager start--standalone
。我怎么能省略它呢?我怎样才能自动完成?提前感谢

只要删除
seleniumAddress
config选项,就可以在启动测试套件时让量角器自己实例化一个新服务器。否则,若指定了服务器地址,则量角器将尝试连接到该地址,而不是创建一个新地址。请查看从测试脚本启动服务器一节:

请注意,如果设置seleniumAddress,则 seleniumServerJar、SeleniumImport、SeleniumMargs、sauceUser和sauceKey 将被忽略


是的,我们需要在config.js中添加以下内容

  • seleniumServerJar:'jar文件的路径'
  • 硒进口:
    '4444'
并从配置文件中删除
seleniumAddress

它工作得非常好