0

I currently have my selenium javascript test set up with the chromedriver configuration below:

const {Builder, By, Key, until} = require('..');    
const  webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().forBrowser('chrome').build();

I followed the instructions that tell you to insert the IEDriverServer.exe in your PATH which I have done and confirmed it is the correct location and file naem. I have also added in the DWORD registry as the same tutorial tells me. All my configuration is correct but I think I am making some assumptions about how things are run with chrome vs. internet explorer.

Here's what I'm doing to run my IE Test, please correct me if I am wrong: new configuration code: const {Builder, By, Key, until} = require('..');

const  webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().forBrowser('internet explorer').build();
  1. Start Selenium Server java -jar selenium-server-standalone-3.9.0.jar in command prompt
  2. Start IEDriverServer.exe in another window by double clicking the .exe file
  3. In a 3rd command prompt window, cd to my folder where my tests and drivers are located and run the test using "node test2.js"

I get the following error message:

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:60381
    at ClientRequest.<anonymous> (<file path omitted>\index.js:244:15)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Any help is appreciated. Thank you!

Melissa
  • 43
  • 9
  • possibly a firewall issue. see [this question](https://stackoverflow.com/questions/44060582/java-selenium-webdriver-connection-refused) for other solutions. – lloyd Mar 08 '18 at 02:14
  • I had a firewall prompt for both the iedriverserver and the selenium server and I accepted them both. I don't know what else needs to go through the firewall. – Melissa Mar 08 '18 at 13:39

1 Answers1

0

It works for me, I use firefox, chrome, ie. But capabilities doesn't want to be applied and it seems that they don't work.

var webdriver = require("selenium-webdriver");

var DriverFactory = {
    create: function (browser) {
        if (browser == "ie" || browser == "internet explorer") {
            let capabilities = webdriver.Capabilities.ie();
            capabilities.set("ignoreProtectedModeSettings", true);
            capabilities.set("ignoreZoomSetting", true);
            return driver = new webdriver.Builder().withCapabilities(capabilities).build();
        } else {
            return driver = new webdriver
                .Builder().forBrowser(browser)
                .build();
        }
    }
}
module.exports = DriverFactory;

then just import the module, and call it

async function () {
    driver = await DriverFactory.create("firefox");
};
B.Misha
  • 107
  • 9