crawling_test.js 1.05 KB
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();
})();