Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Kenneth Huynh
Kenneth Huynh
4,712 Points

mocha not able to locate any WebDriver executable for testing

I get the following message when i run mocha.

[INFO] Searching for WebDriver executables installed on the current system... [WARNING] Unable to locate any WebDriver executables for testing [INFO] Running tests against []

0 passing (0ms)

It seems as if mocha isn't picking up the drivers but they are installed.

3 Answers

Hi! i had the same trouble and i tried to put the following command: require("chromedriver"); And it works for me.

Hope it works for you too.

Ari Misha
Ari Misha
19,323 Points

Hiya there! It seems like mocha can't find Selenium web driver. You might have to install either Selenium Webdriver or you could just go for headless PhantomJS which doesn't require any kinda drivers.

do this:

npm install chromedriver --save;

npm install geckodriver --save;

then add in invitee.js file:



Your code will look something like this:

const {Browser, By, Key, until} = require("selenium-webdriver");
const {suite} = require("selenium-webdriver/testing");
const assert = require('assert');

const url = "https://treehouse-projects.github.io/selenium-webdriver-intermediate/waits/app/index.html";

suite(function(env) {
    describe('RSVP site', function() {

        it('has invitee list', async function() {
            let driver = await env.builder().build();
            await driver.get(url);
            let elements = await driver.findElements(By.id('invitedList'));
            assert(elements.length > 0);