신원형

implemented weather forecast

......@@ -5,6 +5,23 @@
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"skipFiles": [
"<node_internals>/**/*.js"
]
},
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
......
......@@ -87,7 +87,7 @@ export async function load(driver, until) {
export async function logout(driver) {
await driver.get("https://khcanvas.khu.ac.kr/")
const logoutPanel = await driver.findElement(selenium.By.xpath('html/body/div[2]/header[2]/div[1]/ul/li[1]/button/div[1]')).click();
await driver.findElement(selenium.By.xpath('html/body/div[2]/header[2]/div[1]/ul/li[1]/button/div[1]')).click();
await sleep(1000)
const logout = await driver.findElement(selenium.By.xpath('html/body/div[3]/span/span/div/div/div/div/div/span/form/button'));
logout.click()
......
import fs from 'fs/promises'
import { login, load, logout } from './khcanvas.js';
fs.readFile("asdffdsa.txt").then(it => {
const auth = it.toString().split('|')
login(auth[0], auth[1]).then(async driver => {
load(driver, new Date())
.then(it => {
console.log(it)
logout(driver)
})
}).catch(err => { console.log(err) })
})
\ No newline at end of file
This diff is collapsed. Click to expand it.
......@@ -13,13 +13,15 @@
"author": "",
"license": "",
"dependencies": {
"@types/axios": "^0.14.0",
"@types/selenium-webdriver": "^4.1.0",
"eslint": "^8.15.0",
"axios": "^0.27.2",
"mocha": "^10.0.0",
"selenium-webdriver": "^4.1.2"
},
"type": "module",
"devDependencies": {
"@types/node": "^17.0.35"
"@types/node": "^17.0.35",
"eslint": "^8.16.0"
}
}
......