Commit 75796e98 by 马玮

easypass ended

parent 199080ab
...@@ -17,5 +17,4 @@ Installation ...@@ -17,5 +17,4 @@ Installation
To do list: To do list:
------ ------
1.Add random delay when access a page 1.Fetch easypass clues
2.Add error stack \ No newline at end of file
\ No newline at end of file
...@@ -101,7 +101,7 @@ class AutoHome { ...@@ -101,7 +101,7 @@ class AutoHome {
} catch (e) { } catch (e) {
console.log(e.message); console.log(e.message);
} }
console.log('成功就不走这'); console.log('开始表单登录');
const username = this.params.username; const username = this.params.username;
const password = this.params.password; const password = this.params.password;
...@@ -114,7 +114,7 @@ class AutoHome { ...@@ -114,7 +114,7 @@ class AutoHome {
horseman horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0') .userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.viewport(1920, 1080) .viewport(1920, 1080)
.open('http://ics.autohome.com.cn/passport/Home/Index'); .open('http://ics.autohome.com.cn/passport/');
horseman.on('onResourceRequested', (requestData, networkRequest) => { horseman.on('onResourceRequested', (requestData, networkRequest) => {
console.info('Requesting', requestData.url); console.info('Requesting', requestData.url);
...@@ -164,6 +164,7 @@ class AutoHome { ...@@ -164,6 +164,7 @@ class AutoHome {
.waitForNextPage({ timeout: 5000 }) .waitForNextPage({ timeout: 5000 })
.screenshot('m3.png') .screenshot('m3.png')
.exists('#loginout'); .exists('#loginout');
if (loginSuccess) { if (loginSuccess) {
console.log('登录成功!'); console.log('登录成功!');
const cookies = await horseman .cookies().close(); const cookies = await horseman .cookies().close();
...@@ -202,7 +203,7 @@ class AutoHome { ...@@ -202,7 +203,7 @@ class AutoHome {
const Cookie = tough.Cookie; const Cookie = tough.Cookie;
cookies.forEach((cookieObj) => { 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'); 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