title: ChromeOptions causes reference error using Selenium ChromeDriver for node.js
body: <p>I am trying to use the ChromeDriver driver for Selenium to run some tests using Chrome, but I'm getting a reference error when I use <code>ChromeOptions</code>.</p>
  
  <h1>My Code</h1>
  
  <p>I want to force the use of certain options, such as testing it against a particular user profile. Based on the Selenium and ChromeDriver documentation, this is my file <code>test.js</code>:</p>
  
  <pre><code>opt = new chromeOptions(); // ERROR OCCURS HERE!
  opt.setBinary("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
  opt.addArguments("--user-data-dir=C:\\Users\\MyUserAccount\\AppData\\Local\\Google\\Chrome\\User Data");
  driver = new ChromeDriver(opt);
  
  // rest of my script goes here
  </code></pre>
  
  <h1>The error</h1>
  
  <p>I am executing this using the command <code>node test.js</code>. This throws the following error on the first line:</p>
  
  <pre><code>\path\to\test.js:1
  
  ction (exports, require, module, __filename, __dirname) { opt = new chromeOpti
                                                                      ^
  ReferenceError: chromeOptions is not defined
      at Object.&lt;anonymous&gt; (\path\to\test.js:1:73)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:902:3
  </code></pre>
  
  <p>For what it's worth, if I skip setting options and replace the first four lines of the script with this, it works, but I can't set the options I need to set:</p>
  
  <pre><code>var webdriver = require('selenium-webdriver');
  var driver = new webdriver.Builder().
      withCapabilities(webdriver.Capabilities.chrome()).
      build();
  </code></pre>
  
  <p>I'm sure that I'm missing something really basic, but I can't figure this one out.  How can I set options for Chrome using Selenium and node.js?</p>
  
  <p><em>Edited to remove some obviously invalid syntax from the samples in some of the documentation I found.</em></p>