title: Better way to execute Javascript in Jmeter
body: <p>SetUp part of my Jmeter script contains steps to bypass login page of my Web Application before generating real load. As a result of these steps, server sets specific cookie that proves successful loginization. </p>
  
  <p>To do that, my script should execute Javascript function injected in response by server. Since it's a one-time procedure, I do it using WebDriver and execute Javascript within browser instance.</p>
  
  <p>But I definitely can't do the same as a part of load thread as WebDriver is not a good idea (at all) for performance testing.</p>
  
  <p>However, I'm still wondering is it a way to calculate JS without creating a browser instance, because my JS script is nothing but arithmetic calculations (complex though). So,</p>
  
  <ol>
  <li>Any ideas about how to execute JS without creating browser instance are very much appreciated. Since I can write BeanShell code, it shouldn't be a big issue (just share the lib name that can create "virtual" browser for calculations not related to DOM). Not sure that it'll be faster, but I'll try to.</li>
  <li>If I'm right and browser usage is the only possible solution, then I'm looking for a way to share one single browser window between different threads (even with delay for those who waits for it). Tried to use JavascriptExecutor, but don't know how to convert WebDriver to JavascriptExecutor (beanshell is written using too old Java, and I'm not familiar with its syntax and functionality). Can't use WebDriver plugin too as it doesn't allow just to create window without get("pageUrl").</li>
  </ol>
  
  <p>Thanks for any ideas in advance.</p>