add example
This commit is contained in:
commit
586369a9ad
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.env
|
||||||
|
node_modules/
|
||||||
|
*.png
|
||||||
23
example.js
Normal file
23
example.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { launch } from 'puppeteer';
|
||||||
|
import 'dotenv/config.js'
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const browser = await launch({ headless: true, args: [`--window-size=1920,1080`], defaultViewport: { width: 1920, height: 1080 } });
|
||||||
|
const page = await browser.newPage();
|
||||||
|
await page.setViewport({ width: 1920, height: 1080 });
|
||||||
|
await page.goto('https://dev-dmp.meiguanjia.net/login');
|
||||||
|
await page.locator('#userName input').fill(process.env.ACCOUNT);
|
||||||
|
await page.locator('.forgot_box').click();
|
||||||
|
await page.waitForSelector('.modify_main');
|
||||||
|
await page.locator('#digitalCode input').fill('1');
|
||||||
|
await page.locator('#smsCode input').fill(process.env.SMS);
|
||||||
|
await page.locator('#newPassWord input').fill(process.env.PASSWORD);
|
||||||
|
await page.locator('#confirmPassWord input').fill(process.env.PASSWORD);
|
||||||
|
await page.locator('[type="submit"]').click();
|
||||||
|
await page.waitForSelector('.arco-message .arco-message-content', { visible: true });
|
||||||
|
const arcoMessage = await page.$eval('.arco-message .arco-message-content', node => node.innerHTML);
|
||||||
|
await page.screenshot({ path: 'resetPassword.png' });
|
||||||
|
console.log(arcoMessage);
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
})();
|
||||||
1185
package-lock.json
generated
Normal file
1185
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
package.json
Normal file
7
package.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"puppeteer": "^22.13.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user