fix
This commit is contained in:
parent
17d6dd7cf6
commit
198ba79187
6
login.js
6
login.js
@ -3,7 +3,7 @@ import fs from 'fs';
|
|||||||
import 'dotenv/config.js';
|
import 'dotenv/config.js';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const browser = await launch({ headless: true, args: [`--window-size=1920,1080`], defaultViewport: { width: 1920, height: 1080 } });
|
const browser = await launch({ headless: false, args: [`--window-size=1920,1080`], defaultViewport: { width: 1920, height: 1080 } });
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
await page.goto('https://dev-dmp.meiguanjia.net/login');
|
await page.goto('https://dev-dmp.meiguanjia.net/login');
|
||||||
await page.locator('#userName input').fill(process.env.ACCOUNT);
|
await page.locator('#userName input').fill(process.env.ACCOUNT);
|
||||||
@ -19,6 +19,10 @@ import 'dotenv/config.js';
|
|||||||
|
|
||||||
const importStorage = JSON.stringify(localStorage);
|
const importStorage = JSON.stringify(localStorage);
|
||||||
const file = './data/user.json';
|
const file = './data/user.json';
|
||||||
|
if (!fs.existsSync('./data/')) {
|
||||||
|
fs.mkdirSync('./data/');
|
||||||
|
console.log('文件夹不存在,创建文件夹');
|
||||||
|
}
|
||||||
fs.writeFileSync(file, importStorage, 'utf-8');
|
fs.writeFileSync(file, importStorage, 'utf-8');
|
||||||
await browser.close();
|
await browser.close();
|
||||||
})();
|
})();
|
||||||
Loading…
Reference in New Issue
Block a user