Skip to content

Commit

Permalink
feat: 添加粉笔网provider
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Dec 3, 2017
1 parent 6e339f3 commit e409bbe
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/providers/粉笔网.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const Provider = require('../provider');
const utils = require('../utils');

module.exports = class extends Provider {
constructor() {
super();
this.url = `http://fenbi.com/web/signup`;
}
async resolve(ctx) {
const options = ctx.options;
const page = ctx.page;

await page.waitForSelector('#loginphone', { timeout: 1000 * 3 });

await utils.sleep(1000 * 2);

// 点击注册
await page.click('#loginPasswordPage .registered a');

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

await page.click('#signupPage .verificationCode');

// 检验是否发送成功
try {
await page.waitForSelector('#signupPage .verificationCode[disabled]', {
timeout: 1000 * 3
});
} catch (err) {
throw null;
}
}
};

0 comments on commit e409bbe

Please sign in to comment.