2

Trying to use selenium-webdriver (npm package) and receiving a weird error. Uncaught Error: Server terminated early with status 126

Here is the code that creates the driver:

var chai = require('chai')
chai.use(require('chai-as-promised'))
var expect = chai.expect

var selenium = require('selenium-webdriver')
var By = selenium.By
var chrome = require('selenium-webdriver/chrome')

var path = require('chromedriver').path
var service = new chrome.ServiceBuilder(path).build()
chrome.setDefaultService(service)

var firstVisibleLinkFactory = function firstVisibleLinkFactory(url) {
    return function firstVisibleLink(driver) {
        var links = driver.findElements(By.css('[href="' + url + '"]'))
        return selenium.promise.filter(links, function (link) {
            return link.isDisplayed()
        }).then(function (visibleLinks) {
            return visibleLinks[0]
        })
    }
}

var wait = function wait(driver, ms) {
    driver.wait(function () { return false }, ms).thenCatch(function () { })
}

// Create a new driver before all tests
before(function () {
    this.driver = new selenium.Builder()
        .withCapabilities(selenium.Capabilities.chrome())
        .build()
    console.log(this.driver.getCapabilities())
})

I am on MacOS running El Capitan, and I am running node v0.12.7. Any suggestions would be greatly appreciated. Thanks!

Garrett
  • 699
  • 5
  • 19

1 Answers1

2

We encountered this error when we mistakenly used a 32-bit Google Chromedriver on a 64-bit system. When we used the 64-bit chromedriver, the error went away.

Dave
  • 15,639
  • 133
  • 442
  • 830