title: Chrome Automation using an extension; clicking buttons and filling forms
body: <p>After looking around Stack Overflow for a while, and all the past questions relating to this topic, i haven't really been able to find a suitable answer/question that provides an example of a situation similar to  mine. I basically need to a chrome extension (upon an icon click) to click certain objects/buttons on a page, after filling in certain relevant forms, for example a login button after filling in the relevant username and password boxes, or the search button of a search engine (e.g. Google) after filling in the search bar. </p>
  
  <p>Also, (not directly relevant) before the extension starts to automate certain browser actions, it will open the page i want to edit in a new page, and close the current tab. If it helps, here is some working code i managed to put together so far:</p>
  
  <p><strong><em>background.js</em></strong></p>
  
  <pre><code>    chrome.browserAction.onClicked.addListener(function (tab) {
      chrome.tabs.create({
          url: "http://google.com"
      });
  
      chrome.tabs.getSelected(function (tab2) {
          chrome.tabs.remove(tab.id, function() { });
      });
  
  });
  </code></pre>
  
  <p>I am very new to chrome extensions, and if someone could include examples with their explanation, i would be very grateful! Many thanks in advance! :)</p>