title: Use a Custom Firefox profile with nightwatch.js selenium gecko driver
body: <p>I have search for about 8 hours and read pretty much every related topic on this matter but i didn't found a solution so far. 
  The closest i found is 
  <a href="https://github.com/nightwatchjs/nightwatch/issues/1368" rel="nofollow noreferrer">https://github.com/nightwatchjs/nightwatch/issues/1368</a>
  however that matter was resolved with updating selenium standalone server and i use all the latest versions.</p>
  
  <p>Am in the need of starting the firefox browser with a specific profile which i already configured and named "nightwatch"
  My system pref:
  win 10 64bit
  java version "1.8.0_121"
  npm -version 3.10.10
  geckodriver-v0.18.0-win64
  Selenium standalone 3.5.0
  Firefox developer edition 56.0b5 (64-bit)</p>
  
  <p>My nightwatch.json file is:</p>
  
  <pre><code> {
    "src_folders" : ["nw/tests"],
    "output_folder" : "nw/reports",
    "globals_path" : "nightwatch.globals.js",
    "test_workers": {
      "enabled": true,
      "workers": "auto"
    },
    "selenium" : {
      "start_process" : true,
      "server_path" : "./node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.5.0.jar",
      "log_path" : "nw/logs",
      "host" : "127.0.0.1",
      "port" : 4444,
      "cli_args" : {
        "webdriver.chrome.driver" : "./node_modules/chromedriver/lib/chromedriver/chromedriver.exe",
        "webdriver.ie.driver" : "",
        "webdriver.gecko.driver": "geckoDriver/geckodriver.exe"
      }
    },
    "test_settings" : {
      "default" : {
        "launch_url" : "http://google.com",
        "selenium_port"  : 4444,
        "selenium_host"  : "localhost",
        "silent": true,
        "screenshots" : {
          "enabled" : true,
          "path" : ""
        },
        "desiredCapabilities": {
          "browserName": "firefox",
          "javascriptEnabled": true,
          "acceptSslCerts": true,
      "marionette": false
        }
      }
  
    }
  }
  </code></pre>
  
  <p>I have tried adding</p>
  
  <pre><code>"webdriver.firefox.profile": "nightwatch"
  </code></pre>
  
  <p>in both the selenium and test settings. The browser is started with the needed profile but the url from my test (example: some URL) is never entered thus my test always fails.</p>
  
  <p>If i put "marionette":true as described in the issue above Firefox is not started with the desired "nightwatch" profile and additionally my test is always failing at the 1st line .waitForElementVisible("body", 1000)</p>
  
  <p>I have been search and reading a lot on the issue and didn't found something that will help me. I understood that the gecko driver has the possibility on receiving arguments in which the firefox profile can be specified, however my knowledge is very limited on the subject (4 days into nightwatch) and i simply can't resolve it at this moment.
  I even tried modifying the selenium.js file within .\nightwatch\lib\runner</p>
  
  <p>with the following:</p>
  
  <pre><code>this.cliOpts = [
      '-Dwebdriver.firefox.profile=nightwatch', //i added this line in the file .\node_modules\nightwatch\lib\runner\selenium.js
      '-jar', this.settings.selenium.server_path,
      '-port', this.port
    ];
  </code></pre>
  
  <p>The same issue happens, Firefox browser is opened with the desired profile but the test is just not executing and it fails completely after 30sec of wait with the log saying "java.lang.NullPointerException"</p>
  
  <p><strong>Added content to reflect the comments below</strong>
  When i put the following code </p>
  
  <pre><code>"cli_args" : {
        "webdriver.ie.driver" : "",
        "webdriver.gecko.driver": "geckoDriver/geckodriver.exe",
        "webdriver.firefox.profile": "nightwatch"
  
      }
  </code></pre>
  
  <p>Firefox is started with the desired profile but the test is not executing (not entering even the test URL (as mentioned above). As the log is too long to be included in the original post it is available on google drive <a href="https://drive.google.com/open?id=0Bz4bu5Fo5Vq_NEhEZFlnSDBjWm8" rel="nofollow noreferrer">https://drive.google.com/open?id=0Bz4bu5Fo5Vq_NEhEZFlnSDBjWm8</a></p>