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 0939b50 commit 7fc61d0
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://mall.slswd.com/register!toPc.htm`;
}
async resolve(ctx) {
const options = ctx.options;
const page = ctx.page;

await utils.mockUserMouse(page);

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

// 按下鼠标,拖动滚动条
await page.mouse.move(302, 369);
await page.mouse.down();
await page.mouse.move(552, 366, { steps: 20 });
await utils.sleep(500);
await page.mouse.up();
// 松开鼠标

await page.click('#button');

await utils.sleep(100);

// 检验是否发送成功
await page.waitForSelector('#button[disabled]');
}
};

0 comments on commit 7fc61d0

Please sign in to comment.