CasperJs Google登录 [英] CasperJs Google login
问题描述
我一直在编写一些代码来访问我的Google CSE
,为此,我需要使用自己的Google帐户登录。
I having been working on some code to access my google CSE For that I need to sign in with my google account.
我有以下内容代码:
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
waitTimeout: 5000,
clientScripts: ["libs/jquery.min.js"],
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5)
AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4'
});
const google_email = "MY_EMAIL";
const google_passwd = "MY_PASSWORD";
const loginUrl = 'https://accounts.google.com';
casper.start(loginUrl, function() {
this.waitForSelector('#view_container > form');
});
casper.then(function() {
this.fillSelectors('#view_container > form', {
'input[name="identifier"]': google_email
}, false);
});
casper.then(function() {
this.click('#identifierNext');
});
casper.wait(500, function() { //Wait for next page to load
this.capture('images/step01.png');
});
casper.then(function() {
this.evaluate(function () {
var identifierNext = $('#identifierNext');
identifierNext.click();
});
});
casper.then(function() {
this.capture('images/step02.png');
});
casper.run(function() {
this.echo("Done");
});
输入电子邮件的部分似乎有效。
The part of entering the email seems to work.
但是点击部分无法正常工作。
But the click part isn't working.
我发现这个,但它似乎已经过时了。
I found this but it seems outdated.
谢谢
推荐答案
我还没有解决与新表单有关的问题,但是我们找到了一种访问旧表单的方法,因此旧脚本应该仍然有效,并且该解决方案正在禁用JS。为此,请将loginUrl更改为
I haven't fixed the issue related to the new form, but we found a way to access the old form, so the "old" scripts should still work, and that solution is disabling JS. For that, change the loginUrl to
重要的事情:nojavascript = 1
Important thing: nojavascript=1
我们正在使用 Casperjs Google登录发布的脚本不起作用
仅更改登录URL
We are using the script posted in Casperjs Google Login Not working Just changing the login URL.
这篇关于CasperJs Google登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!