title: Facebook auto-login JS works in console but not in GM script
body: <p>I am trying to create an auto login script for Facebook rather than use a preexisting one. When I run the following code in the javascript console of both Firefox and Chrome both the username and password fields are filled out as expected:</p>
  
  <pre><code>var username = "myemail@email.com";
  var password = "password";
  var f = document.getElementById("login_form");
  f.elements.namedItem("email").value = username;
  f.elements.namedItem("pass").value = password; 
  </code></pre>
  
  <p>but when I run it as a Greasemonkey script they don't fill out:</p>
  
  <pre><code>// ==UserScript==
  // @name           Auto Login for FB
  // @namespace      hamsolo474
  // @description    AutoLogin 
  // @include        https://www.facebook.com
  // ==/UserScript==
  var username = "myemail@email.com";
  var password = "password";
  var f = document.getElementById("login_form");
  f.elements.namedItem("email").value = username;
  f.elements.namedItem("pass").value = password; 
  </code></pre>
  
  <p>I read through <a href="http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Pitfall_.233%3a_Named_Forms_and_Form_Elements" rel="nofollow">this link</a> but that didn't seem to help. This is a derivative of a GM script that I run successfully on other websites, I don't understand why its not working here, any help would be greatly appreciated!</p>
  
  <hr>
  
  <p><b>EDIT:</b><br>
  I have also tried an alternate method of: </p>
  
  <pre><code>var username = "myemail@email.com";
  var password = "password";
  document.getElementsByName("email", "input")[0].value = username;
  document.getElementsByName("pass", "input")[0].value = password;
  </code></pre>
  
  <p>as the javascript and:</p>
  
  <pre><code>// ==UserScript==
  // @name           Auto Login for FB
  // @namespace      hamsolo474
  // @description    AutoLogin 
  // @include        https://www.facebook.com
  // ==/UserScript==
  var username = "myemail@email.com";
  var password = "password";
  document.getElementsByName("email", "input")[0].value = username;
  document.getElementsByName("pass", "input")[0].value = password;
  </code></pre>
  
  <p>as the GM, much like my first method it works in the JS console for both Firefox and Chrome, but not in GM for either.</p>