summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-11-10 23:46:39 +0300
committereug-vs <eug-vs@keemail.me>2020-11-10 23:47:10 +0300
commit4ac357c935fdcf07ad46301572a703f2fece56d7 (patch)
tree519a653cf8c8fea4a2ebc849b4bff0ea9e682aef
parent4a1a10c53a3ea08f395fcbee447d4babcb86f792 (diff)
downloadbsu-fantom-4ac357c935fdcf07ad46301572a703f2fece56d7.tar.gz
chore: install dotenv
-rw-r--r--package-lock.json5
-rw-r--r--package.json1
-rw-r--r--src/index.js14
3 files changed, 13 insertions, 7 deletions
diff --git a/package-lock.json b/package-lock.json
index fb76e86..91fa7e0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -90,6 +90,11 @@
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.809251.tgz",
"integrity": "sha512-pf+2OY6ghMDPjKkzSWxHMq+McD+9Ojmq5XVRYpv/kPd9sTMQxzEt21592a31API8qRjro0iYYOc3ag46qF/1FA=="
},
+ "dotenv": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
+ "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
+ },
"end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
diff --git a/package.json b/package.json
index f3963e8..c7982a2 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
},
"author": "eug-vs",
"dependencies": {
+ "dotenv": "^8.2.0",
"puppeteer": "^5.4.1"
}
}
diff --git a/src/index.js b/src/index.js
index a318ccd..507085a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,5 +1,12 @@
+require('dotenv').config();
const puppeteer = require('puppeteer');
+
+const clickElementByXPath = (page, xPath) => page
+ .waitForXPath(xPath)
+ .then(item => item.click());
+
+
const {
EDUFPMI_URL,
EDUFPMI_USERNAME,
@@ -7,12 +14,6 @@ const {
COURSE_URL
} = process.env;
-
-const clickElementByXPath = (page, xPath) => page
- .waitForXPath(xPath)
- .then(item => item.click());
-
-
puppeteer.launch({ headless: true })
.then(async browser => {
const page = await browser.newPage();
@@ -27,7 +28,6 @@ puppeteer.launch({ headless: true })
// Launch a meeting
await page.goto(COURSE_URL, { waitUntil: 'networkidle0' });
- await page.screenshot({ path: './screenshot1.png' });
const moodlePagePromise = new Promise(resolve => browser.on(
'targetcreated',
target => resolve(target.page())