title: Chrome Extension: Open tab, go to url, fill form and submit form
body: <p>I am following a tutorial here 
  <a href="http://www.blackweb20.com/2010/01/11/creating-your-own-google-chrome-extension/" rel="nofollow">http://www.blackweb20.com/2010/01/11/creating-your-own-google-chrome-extension/</a></p>
  
  <p>I can open fine a tab with a custom extension and load a url, and I would like to fill and submit a form with javascript on the page opened. For example, could I submit a search on google.com?</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>manifest.json
  {
    "name": "My First Extension",
    "version": "1.0",
    "description": "The first extension that I made.",
    "browser_action": {
      "default_icon": "icon.png"
    },
    "background_page": "background.html",
    "permissions": [
      "tabs"
    ]
  }
  </code></pre>
  
  <p>background.html</p>
  
  <pre><code>&lt;script&gt;
  
  // get tab http://stackoverflow.com/questions/1979583/how-can-i-get-the-url-for-a-google-chrome-tab
  
  
  chrome.browserAction.onClicked.addListener(function(tab) {
    chrome.tabs.create({'url': "http://google.com"}, function(tab) {
      // Tab opened. Wait until page loads, from here it is not working
      jQuery(document).ready(function() {
          jQuery('#tsf').submit();
          });
    });
  });
  &lt;/script&gt;
  </code></pre>