-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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 page.click('[name="voice"]'); | ||
|
||
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; | ||
} | ||
} | ||
}; |