我试图为Facebook创建一个自动登录脚本, 而不是使用先前存在的脚本。 当我在 Firefox 和 Chrome 的 javascript 控制台运行下列代码时, 用户名和密码字段都会按预期填写 :
var username = "[email protected]";
var password = "password";
var f = document.getElementById("login_form");
f.elements.namedItem("email").value = username;
f.elements.namedItem("pass").value = password;
但当我把它当作一个Greasemonkey脚本运行时,他们不填写:
// ==UserScript==
// @name Auto Login for FB
// @namespace hamsolo474
// @description AutoLogin
// @include https://www.facebook.com
// ==/UserScript==
var username = "[email protected]";
var password = "password";
var f = document.getElementById("login_form");
f.elements.namedItem("email").value = username;
f.elements.namedItem("pass").value = password;
我通过
EDIT:
I have also tried an alternate method of:
var username = "[email protected]";
var password = "password";
document.getElementsByName("email", "input")[0].value = username;
document.getElementsByName("pass", "input")[0].value = password;
做为标本和:
// ==UserScript==
// @name Auto Login for FB
// @namespace hamsolo474
// @description AutoLogin
// @include https://www.facebook.com
// ==/UserScript==
var username = "[email protected]";
var password = "password";
document.getElementsByName("email", "input")[0].value = username;
document.getElementsByName("pass", "input")[0].value = password;
作为全球机制, 非常像我的第一种方法, 它在联署材料控制台工作 火狐和铬, 但对于全球机制也不行。