-
Notifications
You must be signed in to change notification settings - Fork 143
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
3 changed files
with
44 additions
and
2 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
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,41 @@ | ||
const Provider = require('../provider'); | ||
const utils = require('../utils'); | ||
|
||
class XinNetProvider extends Provider { | ||
constructor() { | ||
super(); | ||
this.url = `http://www.xinnet.com/user/user.do?method=toRegister`; | ||
} | ||
async resolve(ctx) { | ||
const options = ctx.options; | ||
|
||
const page = ctx.page; | ||
|
||
const [$mobile, $submit] = await Promise.all([ | ||
page.$('#userMobiNumber'), | ||
page.$('#verifyCode_href') | ||
]); | ||
|
||
await $mobile.click(); | ||
await page.type(options.phone, { delay: 100 }); | ||
|
||
// 按下鼠标,拖动滚动条 | ||
await page.mouse.move(460, 470); | ||
await page.mouse.down({ | ||
button: 'left' | ||
}); | ||
|
||
await page.mouse.move(750, 470, { steps: 10 }); | ||
|
||
await utils.sleep(1000); | ||
|
||
await page.mouse.up({ button: 'left' }); | ||
// 松开鼠标 | ||
|
||
await utils.sleep(1000); | ||
|
||
await $submit.click(); | ||
} | ||
} | ||
|
||
module.exports = XinNetProvider; |
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