When you look into doing this the first avenue you may come across is the Selenium preference javascript.enabled. This is bogus for a couple of reasons:

  1. A lot of test runners will have this preference in a desired capabilities section. Note the desired part; the selenium being used may not be able to satisfy this preference and JavaScript will continue to run.

  2. This preference is to disable JavaScript totally - this includes the JavaScript required for some of the functionality of Selenium WebDriver.

What you are probably looking for is to disable JavaScript from executing on the page, but still being able to click on things and query the DOM with Selenium.

htmlunit

To have the functionality described in the previous paragraph set the browserName property to htmlunit. This is a driver that has JavaScript disabled by default.

Using the official Selenium servers that come with Chrome or Firefox this will work without any extra configuration or installation required.

This repository on github shows a setup using the nightwatch testing framework.

nightwatch