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 551ef3f commit 0a935ac
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app/providers/乾贷网短信.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Provider = require('../provider');
const utils = require('../utils');

module.exports = class extends Provider {
constructor() {
super();
this.url = `https://www.qiandw.com/Account/RegisterNew`;
}
async resolve(ctx) {
const options = ctx.options;
const page = ctx.page;

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

await utils.mockUserMouse(page);
// 按下鼠标,拖动滚动条
await page.mouse.move(510, 344);
await page.mouse.down();
await page.mouse.move(860, 338, { steps: 5 });
await page.mouse.up();
// 松开鼠标

// 检验是否发送成功
try {
await page.evaluate(() => {
const display = document.querySelector('.resend.text-send').style.display;
// 倒计时应该会被显示出来
return display !== 'none' && display !== '';
});
} catch (err) {
throw null;
}
}
};

0 comments on commit 0a935ac

Please sign in to comment.