Running a test case on selenium node js got error Error: ECONNREFUSED connect ECONNREFUSED.
Test case
var assert = require('assert'),
test = require('selenium-webdriver/testing'),
webdriver = require('selenium-webdriver');
test.describe('Google Search', function () {
test.it('should work', function (done) {
this.timeout(100000);
var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
driver.get('http://www.google.com');
var searchBox = driver.findElement(webdriver.By.name('q'));
searchBox.sendKeys('simple programmer');
searchBox.getAttribute('value').then(function (value) {
assert.equal(value, 'simple programmer');
});
driver.quit();
done();
});
});
And the error stack trace as follows
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:63528 at ClientRequest. (node_modules\selenium-webdriver\http\index.js:238:15)
I'm not sure your example would work, if you want to run the tests locally you would need to install and load the correct selenium drivers.
For chrome I tried to use the
var driver = new webdriver.Builder().forBrowser('chrome')
syntax with no luck, chrome would fire up but not run tests, I just saw the error you describe. However for FireFoxvar driver = new webdriver.Builder().forBrowser('firefox').build();
workes perfectly !I found this works (running locally)