최재은

Login crawling test success using puppeteer

const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
const et_id = "";
const et_pw = "";
const lecture = "오픈소스SW개발";
await page.goto('https://everytime.kr/login');
await page.evaluate((id, pw) => {
document.querySelector("input[name=userid]").value = id;
document.querySelector("input[name=password]").value = pw;
}, et_id, et_pw);
await console.log("로그인 정보 삽입 완료")
await page.click('#container > form > p.submit > input');
await page.waitFor(1000);
await page.goto('https://everytime.kr/lecture');
await page.screenshot({ path: 'AfterLogin.png', fullPage:true });
await page.evaluate((lec) => {
document.querySelector("input[name=keyword]").value = lec;
}, lecture);
await page.click('#container > form > input.submit');
await page.waitFor(1000);
await page.click('#container > div > a')
await page.waitFor(1000);
await page.screenshot({ path: 'result.png', fullPage:true });
await browser.close();
})();
\ No newline at end of file
This diff is collapsed. Click to expand it.
......@@ -14,6 +14,8 @@
"dotenv": "^8.0.0",
"express": "^4.17.0",
"mongoose": "^5.5.11",
"puppeteer": "^1.17.0",
"puppeteer-core": "^1.17.0",
"request": "^2.88.0"
}
}
......