Skip to content

Commit

Permalink
fix: 企查查provider没有正确检测是否发送短信成功
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Dec 3, 2017
1 parent e409bbe commit 0bd61bd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/providers/企查查.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,32 @@ module.exports = class extends Provider {
constructor() {
super();
this.url = `http://www.qichacha.com/user_register`;
this.alone = true;
}

async resolve(ctx) {
const options = ctx.options;
const page = ctx.page;

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

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

await utils.mockUserMouse(page);
await page.mouse.move(841, 345);
await page.mouse.down();
await page.mouse.move(1101, 346, { steps: 20 });
await page.mouse.up();

await page.click('a.get-mobile-code');

// await page.waitForSelector('span.input-group-btn button:first-child[disabled]', { timeout: 1000 * 3 });
const isSuccess = await page.evaluate(() => {
const btn = document.querySelector('a.get-mobile-code');
return btn.innerText.indexOf('重新发送') >= 0;
});

if (!isSuccess) {
throw null;
}
}
};

0 comments on commit 0bd61bd

Please sign in to comment.