title: HtmlUnitDriver browser emulate mode
body: <p>I have created a simple factory method that creates a HtmlUnitDriver in a specified mode. For example</p>
  
  <pre><code>public static HtmlUnitDriver createHtmlUnitDriver(String browserMode) {
      switch(browserMode.toLowerCase()) {
          case "chrome":
              return new HtmlUnitDriver(DesiredCapabilities.chrome());
          case "firefox":
              return new HtmlUnitDriver(DesiredCapabilities.firefox());
          case "ie":
          case "internet explorer":
              return new HtmlUnitDriver(DesiredCapabilities.internetExplorer());
          case default:
              return new HtmlUnitDriver(true);
      }
  }
  </code></pre>
  
  <p>I'd like to write a quick unit test of this method, but I can't see how to tell which "mode" the returned <code>HtmlUnitDriver</code> is in. How would I do this?</p>