title: What is the correct way to pass arguments to the JavascriptExecutor?
body: <p>I'm trying to use the <code>JavascriptExecutor</code> for my code, which involved passing in a <code>WebElement</code> and get some info from it. I was getting some errors, so I simplified it down to find the problem.</p>
  
  <p><code>String test = ((JavascriptExecutor)driver).executeScript("return arguments[0];", "macon").toString();</code></p>
  
  <p>That code won't run. It'll throw a <code>NullPointerException</code>. I can avoid it by not trying to access the passed variable. It doesn't seem to matter what I pass; could be an int, string, <code>WebElement</code>, etc etc.</p>
  
  <p>So what's wrong? I can't see any discrepancies between online examples and my code, but there's obviously something. I'm using the Firefox WebDriver, and my Selenium version is 2.44.0</p>