title: Run JavaScript Script snippet automatically
body: <p>I want to run a script snippet on the SAP BO "Query Builder", it's a simple tool to retrieve data using SQL. (I can't upload the image due to the reputation, the product's interface can be found here: <a href="http://scn.sap.com/docs/DOC-42952" rel="nofollow">http://scn.sap.com/docs/DOC-42952</a>)</p>
  
  <p>Since I have a bunch of queries to run, I want to use snippet to run them automatically. Using the following code:</p>
  
  <pre><code>    //select the textarea to insert retrieved queries
      document.querySelector("textarea").textContent = "SELECT * FROM CI_INFOOBJECTS";
      //click the submit button
      document.getElementsByTagName('input')[0].click();
  
      //code to export the query result
  
      //after click(), the page reloaded and it won't executed the following code.
      document.addEventListener("DOMContentLoaded", function() {
      //back to the previous page, run the previous code again
          window.history.back(1);
          }, false);
  </code></pre>
  
  <p>Does anyone have good ideas how to implement it? Thanks for your help.</p>