-
Notifications
You must be signed in to change notification settings - Fork 0
/
testController.js
28 lines (24 loc) · 997 Bytes
/
testController.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import 'dotenv/config'
import { config } from 'dotenv';
import puppeteer from "puppeteer";
import ScrapperController from './ScrapperController.js';
config({override: true});
const url = process.env.TESTURL
const browser = await puppeteer.launch({
executablePath: process.env.BROWSERPATH || '/usr/bin/google-chrome',
headless: false,
});
let controller = new ScrapperController('./articles', url, browser)
await controller.prepare()
await controller.start()
// // await controller.login()
// let items = await controller.getNavItem() //seems ok
// let catPage = await controller.openPageForElement(items[0]); //seems ok
// // let articles = await controller.getArticlesInpage(catPage)
// // console.log(articles)
// let nextPage = await controller.getNextPageButton(catPage);
// console.log(`next button url ${nextPage}`);
// await browser.close()
// let controller = new ScrapperController('./articles');
// await controller.writeVisitedFile();
// await controller.readVisitedFile();