title: How can I automate certain actions on a certain web page using javascript and jquery?
body: <p>I am learning javascript and would like to exercise a simple task, which I just fail to get right.</p>
  
  <p>All I want is to automate these actions:</p>
  
  <ol>
  <li>Navigating to a url</li>
  <li>Logging into the site by typing the password and clicking the login button</li>
  <li>Then click another button, which would open a list of items.</li>
  <li>Enumerate the list of items, expanding each item by clicking a certain link.</li>
  </ol>
  
  <p>This should be basic for any experienced javascript/jquery programmer, but I am kind of lost.</p>
  
  <p>Here is what I have until now:
  html:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Bump the site&lt;/title&gt;
  &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="bump.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>bump.js:</p>
  
  <pre><code>jQuery(function($) {
    var intervalID = null;
  
    function checkPasswordField() {
      $("#password").val("my-password");
      if ($("#password").val() === "my-password") {
        clearInterval(intervalID);
        $("#login")[0].click();
      }
    }
  
    window.location.href = "http://www.the-site.co.il";
    $(document).ready(function() {
      intervalID = window.setInterval(checkPasswordField, 1000);
    });
  });
  </code></pre>
  
  <p>Of course, it does not work. When the site is loaded, the bump.js script is no longer with us - Chrome does not show it in the list of the loaded scripts. I guess, this behavior is logical, but then how do I do it?</p>
  
  <p>Thanks.</p>