박시진

[Modify]compile error, express module

...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
11 "@testing-library/jest-dom": "^5.16.4", 11 "@testing-library/jest-dom": "^5.16.4",
12 "@testing-library/react": "^13.2.0", 12 "@testing-library/react": "^13.2.0",
13 "@testing-library/user-event": "^13.5.0", 13 "@testing-library/user-event": "^13.5.0",
14 + "express": "^4.18.1",
14 "localforage": "^1.10.0", 15 "localforage": "^1.10.0",
15 "puppeteer": "^14.1.1", 16 "puppeteer": "^14.1.1",
16 "react": "^18.1.0", 17 "react": "^18.1.0",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 "@testing-library/jest-dom": "^5.16.4", 6 "@testing-library/jest-dom": "^5.16.4",
7 "@testing-library/react": "^13.2.0", 7 "@testing-library/react": "^13.2.0",
8 "@testing-library/user-event": "^13.5.0", 8 "@testing-library/user-event": "^13.5.0",
9 + "express": "^4.18.1",
9 "localforage": "^1.10.0", 10 "localforage": "^1.10.0",
10 "puppeteer": "^14.1.1", 11 "puppeteer": "^14.1.1",
11 "react": "^18.1.0", 12 "react": "^18.1.0",
......
1 +const puppeteer = require("puppeteer");
1 function login(id, pw) { 2 function login(id, pw) {
2 const crawler = async() => { 3 const crawler = async() => {
3 try{ 4 try{
...@@ -14,6 +15,7 @@ function login(id, pw) { ...@@ -14,6 +15,7 @@ function login(id, pw) {
14 document.querySelector("#login_user_password").value = pw 15 document.querySelector("#login_user_password").value = pw
15 document.querySelector('#form1 > div > div.login_btn > a > span').click(); 16 document.querySelector('#form1 > div > div.login_btn > a > span').click();
16 }) 17 })
18 + await page.waitForTimeout(500);
17 19
18 }catch(err){ 20 }catch(err){
19 console.log(err) 21 console.log(err)
...@@ -28,5 +30,3 @@ function login(id, pw) { ...@@ -28,5 +30,3 @@ function login(id, pw) {
28 } 30 }
29 31
30 export { login }; 32 export { login };
31 -
32 -
......
...@@ -3,6 +3,7 @@ const puppeteer = require("puppeteer"); ...@@ -3,6 +3,7 @@ const puppeteer = require("puppeteer");
3 const crawler = async() => { 3 const crawler = async() => {
4 try{ 4 try{
5 const browser = await puppeteer.launch({headless: false, args:['--window-size=1920,1080']}); 5 const browser = await puppeteer.launch({headless: false, args:['--window-size=1920,1080']});
6 + // for observing the process of login, headless -> false
6 const page = await browser.newPage(); 7 const page = await browser.newPage();
7 await page.setViewport({ 8 await page.setViewport({
8 width:1920, 9 width:1920,
...@@ -10,8 +11,8 @@ const crawler = async() => { ...@@ -10,8 +11,8 @@ const crawler = async() => {
10 }) 11 })
11 await page.goto('https://e-campus.khu.ac.kr/xn-sso/login.php?auto_login=&sso_only=&cvs_lgn=&return_url=https%3A%2F%2Fe-campus.khu.ac.kr%2Fxn-sso%2Fgw-cb.php%3Ffrom%3D%26login_type%3Dstandalone%26return_url%3Dhttps%253A%252F%252Fe-campus.khu.ac.kr%252Flogin%252Fcallback'); 12 await page.goto('https://e-campus.khu.ac.kr/xn-sso/login.php?auto_login=&sso_only=&cvs_lgn=&return_url=https%3A%2F%2Fe-campus.khu.ac.kr%2Fxn-sso%2Fgw-cb.php%3Ffrom%3D%26login_type%3Dstandalone%26return_url%3Dhttps%253A%252F%252Fe-campus.khu.ac.kr%252Flogin%252Fcallback');
12 await page.evaluate(() => { 13 await page.evaluate(() => {
13 - document.querySelector("#login_user_id").value = //자 account id 14 + document.querySelector("#login_user_id").value = //자신의 E_Campus account id
14 - document.querySelector("#login_user_password").value = //자기 pw 15 + document.querySelector("#login_user_password").value = // pw
15 document.querySelector('#form1 > div > div.login_btn > a > span').click(); 16 document.querySelector('#form1 > div > div.login_btn > a > span').click();
16 }) 17 })
17 18
......