From 0a935aca86eb5a6d58640167a7918b199c9567e9 Mon Sep 17 00:00:00 2001 From: axetroy Date: Sun, 3 Dec 2017 20:50:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=B9=BE=E8=B4=B7pro?= =?UTF-8?q?vider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...67\347\275\221\347\237\255\344\277\241.js" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "app/providers/\344\271\276\350\264\267\347\275\221\347\237\255\344\277\241.js" diff --git "a/app/providers/\344\271\276\350\264\267\347\275\221\347\237\255\344\277\241.js" "b/app/providers/\344\271\276\350\264\267\347\275\221\347\237\255\344\277\241.js" new file mode 100644 index 0000000..89f586d --- /dev/null +++ "b/app/providers/\344\271\276\350\264\267\347\275\221\347\237\255\344\277\241.js" @@ -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; + } + } +};