Skip to content

Commit

Permalink
feat: app add baidu
Browse files Browse the repository at this point in the history
  • Loading branch information
WindomZ committed Nov 19, 2017
1 parent cd84a19 commit a832de9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions app/providers/baidu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Created by WindomZ on 17-11-19.
*/
'use strict';

const Provider = require('../provider');
const utils = require('../utils');

module.exports = class extends Provider {
constructor() {
super();
this.url = `https://passport.baidu.com/v2/?login`;
}
async resolve(ctx) {
const options = ctx.options;
const page = ctx.page;

await utils.sleep(500);

await page.click('#TANGRAM__PSP_3__smsSwitch');

await utils.sleep(1000);

await page.type('#TANGRAM__PSP_3__smsPhone', options.phone, { delay: 100 });

await page.click('#TANGRAM__PSP_3__smsTimer');

// 如果需要注册
await page
.waitForSelector('#TANGRAM__PSP_3__smsRegPromptWrapper', { timeout: 500, visible: true })
.then(() => {
page.click('#TANGRAM__PSP_3__smsRegPromptBtn');
});

// 检验是否发送成功
await page.waitForSelector('#TANGRAM__PSP_3__smsTimer.pass-item-time-timing', {
timeout: 1000 * 3,
});
}
};

0 comments on commit a832de9

Please sign in to comment.