Commit b6b634b3 authored by james's avatar james

[ADD] init

parent 571b971c
const puppeteer = require('puppeteer'); const puppeteer = require('puppeteer');
(async () => { (async () => {
const accountName = 'james.chiu';
const accountPwd = 'Ziteng@123456';
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: false // 無外殼的 Chrome,有更佳的效能 headless: false // 無外殼的 Chrome,有更佳的效能
}); });
const page = await browser.newPage(); const page = await browser.newPage();
await page.goto('https://google.com'); await page.goto('https://purplevineip-ilearning.tcl.com/static/admin/#/login');
await page.screenshot({ path: 'example.png' });
try {
await page.waitForSelector('button.login-btn',{
timeout: 1000*10
});
await page.waitForSelector('input[type="password"]',{
timeout: 1000*10
});
await page.waitFor(1000); //等待載入
await page.type('input[type="text"]', accountName);
await page.type('input[type="password"]', accountPwd);
await page.click('button.login-btn');
} catch (e) {
console.log(e.message);
}
await browser.close(); //await browser.close();
})(); })();
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment