title: java.lang.NoSuchMethodError: org.openqa.selenium.firefox.FirefoxOptions.merge(Capabilities) when trying to merge DesiredCapabilities using Selenium
body: <p>When I try launching new <code>Selenium/Firefox</code> instance with <code>DesiredCapabilities</code> and <code>FirfoxOptions</code> I get the following code:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.firefox.FirefoxOptions.merge(Lorg/openqa/selenium/Capabilities;)Lorg/openqa/selenium/firefox/FirefoxOptions;
  </code></pre>
  
  <p>I am using the following code:</p>
  
  <pre><code>public WebDriver getDriver() throws MalformedObjectNameException, InstanceNotFoundException, ReflectionException, InterruptedException
  {
  
      System.setProperty("webdriver.gecko.driver", GlobalVar.geckdriverExecutableFilePath);
  
      //DesiredCapabilities capabilities = new DesiredCapabilities();
  
  
  
      DesiredCapabilities dc = DesiredCapabilities.firefox();
  
  
      if (proxyPOJO != null) {
  
  
          Proxy proxy = new Proxy();
          proxy.setHttpProxy(proxyPOJO.getProxyIP() + ":" + proxyPOJO.getProxyPort());
          proxy.setFtpProxy(proxyPOJO.getProxyIP() + ":" + proxyPOJO.getProxyPort());
          proxy.setSslProxy(proxyPOJO.getProxyIP() + ":" + proxyPOJO.getProxyPort());
  
  
          dc.setCapability(CapabilityType.PROXY, proxy);
      }
  
      FirefoxOptions opt = new FirefoxOptions();
      opt.merge(dc);
  
  
      opt.addPreference("dom.popup_maximum", 200);
      opt.addPreference("dom.webnotifications.enabled", false); 
  
  
      opt.merge(capabilities);
  
  
      WebDriver driver = WebDriverX.getNewFireFoxWebDriver(opt); // Basically calls: driver = new FirefoxDriver(firefoxOptions);  
  
  
      return driver;
  
  
  }
  </code></pre>
  
  <p>My <code>POM</code> file contains the following entries:</p>
  
  <pre><code>&lt;dependencies&gt;
  
       &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
          &lt;version&gt;3.11.0&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;/dependencyManagement&gt;
  
  &lt;dependencies&gt;
  
  &lt;dependency&gt;
  &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
  &lt;/dependency&gt;
  
   &lt;dependency&gt;
  &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
  &lt;artifactId&gt;guava&lt;/artifactId&gt;
  &lt;version&gt;26.0-jre&lt;/version&gt;
   &lt;/dependency&gt;
  </code></pre>
  
  <p></p>
  
  <p>Previously, I had version 3.5.2 of <code>org.seleniumhq.selenium</code> in POM which does not support <code>merge</code> functionality. However, when I tried launching Selenium with version <code>3.5.2</code> using following code:</p>
  
  <pre><code>System.setProperty("webdriver.gecko.driver", GlobalVar.geckdriverExecutableFilePath);
  DesiredCapabilities capabilities = new DesiredCapabilities();
  
      if (proxyPOJO != null) {
  
          Proxy proxy = new Proxy();
          proxy.setHttpProxy(proxyPOJO.getProxyIP() + ":" + proxyPOJO.getProxyPort());
          proxy.setFtpProxy(proxyPOJO.getProxyIP() + ":" + proxyPOJO.getProxyPort());
          proxy.setSslProxy(proxyPOJO.getProxyIP() + ":" + proxyPOJO.getProxyPort());
  
  
          capabilities.setCapability(CapabilityType.PROXY, proxy);
      }
  FirefoxOptions firefoxOptions = new FirefoxOptions(capabilities);
  WebDriver driver = WebDriverX.getNewFireFoxWebDriver(firefoxOptions); 
  </code></pre>
  
  <p>I got the following exception:</p>
  
  <pre><code>NoSuchMethodError: org.openqa.selenium.firefox.FirefoxOptions.&lt;init&gt;(Lorg/openqa/selenium/Capabilities;)V
  </code></pre>
  
  <p>I have latest version of <code>geckodriver.exe</code> installed.</p>
  
  <p>Neither version 3.11.0 or version 3.5.2 is working (I also tried 3.8.2).</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p><em>With version 3.11.0 I get the following stack trace:</em></p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.firefox.FirefoxOptions.merge(Lorg/openqa/selenium/Capabilities;)Lorg/openqa/selenium/firefox/FirefoxOptions;
      at webdriverX.WebDriverProfile.getTMPFirefoxProfile(WebDriverProfile.java:259)
      at s.SPage.scrapeS(SPage.java:36)
      at n.NMain.main(NMain.java:27)
  </code></pre>
  
  <p><em>With version 3.5.2 the following is the stack trace:</em></p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.firefox.FirefoxOptions.&lt;init&gt;(Lorg/openqa/selenium/Capabilities;)V
      at webdriverX.WebDriverProfile.getTMPFirefoxProfile(WebDriverProfile.java:232)
      at s.SPage.scrapeS(SPage.java:36)
      at n.NMain.main(NMain.java:27)
  </code></pre>
  
  <p>The method <code>getTMPFirefoxProfile()</code> basically does the following:</p>
  
  <pre><code>if (firefoxOptions != null) {
      driver = new FirefoxDriver(firefoxOptions);
  } else {
                  driver = new FirefoxDriver();
  }
  </code></pre>
  
  <p>Thanks!!</p>