title: How to return the response body from javascript function execution - in java?
body: <p>Does anyone know how to return the response body from javascript function execution - in java as a string?</p>
  
  <p>I tried this : </p>
  
  <p><a href="http://kodejava.org/how-do-i-get-http-response-body-as-a-string/" rel="nofollow">http://kodejava.org/how-do-i-get-http-response-body-as-a-string/</a></p>
  
  <p>It's actually very helpful , but it only returns the HTML code of my page . There's a button on that page which calls JS function and I need to retrieve the network HTTP response after executing the function . </p>
  
  <p>Is there any way to do this ? </p>
  
  <p>====================================================================</p>
  
  <p>I need something like this :</p>
  
  <pre><code>WebDriver driver = new FirefoxDriver();
  
  driver.get(URL);
  
  driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  
  ((JavascriptExecutor) driver).executeScript("JS({something})");
  </code></pre>
  
  <p>and then after the script is executed I need something to retrieve the content of the response</p>
  
  <p>Is that possible at all ?</p>