title: How do I execute a javascript method attached to a button in webdriver?
body: <p>I am trying to execute a javascript method that is attached to a button in webdriver.</p>
  
  <p>I have some thing like: </p>
  
  <pre><code>driver.FindElement(By.Id(Button)).click();
  </code></pre>
  
  <p>This button has an <code>"onclick=javascript:method()"</code> attached to it. So when i run the test on a browser it works fine. But if i run it in htmlunit the onclick method is not executed.</p>
  
  <p>I tried something like this:</p>
  
  <pre><code>IJavascriptExecutor js = (IJavascriptExecutor) driver;
  js.executeScript(""); 
  </code></pre>
  
  <p>But not sure how to enter the method name in the " "</p>