Issue when using gulp to run protractor and selenium

让人想犯罪 __ 提交于 2019-12-06 03:35:43

The error indicates that protractor is attempting to connect to the webdriver, and the TCP connection is refused. This is probably because the webdriver is not running.

Your gulp file defines a task for starting the webdriver:

// Runs the selenium webdriver
gulp.task('webdriver_standalone', webdriver_standalone);

To run it:

gulp webdriver_standalone

Leave it running, and then run the gulp task to start the tests.

Alternatively, you can let protractor start and stop the webdriver for you. From the documentation:

You have 2 options to start the selenium server.

The first one is to let Protractor handle it automatically, including stopping it once your tests are done. To do that, simply point to the selenium jar in the protractor config file (you will need to update the version number accordingly) instead of the address:

// The file path to the selenium server jar ()
seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar',
// seleniumAddress: 'http://localhost:4444/wd/hub',
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!