Commit 75796e98 by 马玮

easypass ended

parent 199080ab
......@@ -17,5 +17,4 @@ Installation
To do list:
------
1.Add random delay when access a page
2.Add error stack
\ No newline at end of file
1.Fetch easypass clues
\ No newline at end of file
......@@ -101,7 +101,7 @@ class AutoHome {
} catch (e) {
console.log(e.message);
}
console.log('成功就不走这');
console.log('开始表单登录');
const username = this.params.username;
const password = this.params.password;
......@@ -114,7 +114,7 @@ class AutoHome {
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.viewport(1920, 1080)
.open('http://ics.autohome.com.cn/passport/Home/Index');
.open('http://ics.autohome.com.cn/passport/');
horseman.on('onResourceRequested', (requestData, networkRequest) => {
console.info('Requesting', requestData.url);
......@@ -164,6 +164,7 @@ class AutoHome {
.waitForNextPage({ timeout: 5000 })
.screenshot('m3.png')
.exists('#loginout');
if (loginSuccess) {
console.log('登录成功!');
const cookies = await horseman .cookies().close();
......@@ -202,7 +203,7 @@ class AutoHome {
const Cookie = tough.Cookie;
cookies.forEach((cookieObj) => {
let cookieStr = cookieObj.name + "=" + cookieObj.value + "; path=" + cookieObj.path + "; domain=" + cookieObj.domain;
let cookieStr = cookieObj.name + '=' + cookieObj.value + '; path=' + cookieObj.path + '; domain=' + cookieObj.domain;
cookieJar.setCookieSync(cookieStr, 'http://ics.autohome.com.cn');
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment