Skip to content

Commit

Permalink
feat: 添加好美家provider
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Nov 26, 2017
1 parent 4be0ce5 commit bf991b5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions app/providers/好美家.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const Provider = require('../provider');
const utils = require('../utils');

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

await page.type('input[name="mobile"]', options.phone, { delay: 100 });

await page.type('input[name="verifyCode"]', options.phone, { delay: 50 });

await page.click('button[ng-bind="verifyButtonTitle"]');

// 检验是否发送成功

await utils.sleep(500);

const isSuccess = await page.evaluate(() => {
const button = document.querySelector('button[ng-bind="verifyButtonTitle"]');
return /^\d+$/.test(button.innerText);
});

if (isSuccess === false) {
throw null;
}
}
};

0 comments on commit bf991b5

Please sign in to comment.