This program works well on puppeteer when i use it on CMD. Although, it is a lengthy process and also complicated for any non-technical person. I want to make an exe file that perform the task I do manually to run this node.js file in CMD. As you can see first my program will open the browser and goto a (URL). I want to make different program with different URL. So that, if a person want to run this code, he just click the exe file and then that software will automatically do that task for the user.
const puppeteer = require('puppeteer');
async function getPic() {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.setViewport({width: 2576, height: 4134})
await page.goto('http://absoluteindianews.com/epaper-
en/index.php/epaper/edition/906/delhi-edition');
for (let i=1; i<=8; i++){
await page.click('#page_area > a > img');
await page.waitFor(4000);
await page.screenshot({path: 'C:/Users/biznis/Desktop/automatic
downloading/Puppeteer/AbsoluteIndia/Delhi/Delhi'+ i +'.png'});
await page.waitFor(2000);
await page.click('#cboxLoadedContent > img');
await page.waitFor(2000);
if(i<8) {
await page.click('#yw1 > li.next > a');
}
await page.waitFor(2000);
};
await page.setViewport({width: 2576, height: 4134})
await page.goto('http://absoluteindianews.com/epaper-
en/index.php/epaper/edition/905/mumbai-edition');
for (let i=1; i<=8; i++){
await page.click('#page_area > a > img');
await page.waitFor(4000);
await page.screenshot({path: 'C:/Users/biznis/Desktop/automatic
downloading/Puppeteer/AbsoluteIndia/Mumbai/Mumbai'+ i +'.png'});
await page.waitFor(2000);
await page.click('#cboxLoadedContent > img');
await page.waitFor(2000);
if(i<8) {
await page.click('#yw1 > li.next > a');
}
await page.waitFor(2000);
};
await page.setViewport({width: 2576, height: 4134})
await page.goto('http://absoluteindianews.com/epaper-
en/index.php/epaper/edition/904/bhopal-absolute');
for (let i=1; i<=8; i++){
await page.click('#page_area > a > img');
await page.waitFor(4000);
await page.screenshot({path: 'C:/Users/biznis/Desktop/automatic
downloading/Puppeteer/AbsoluteIndia/Bhopal/Bhopal'+ i +'.png'});
await page.waitFor(2000);
await page.click('#cboxLoadedContent > img');
await page.waitFor(2000);
if(i<8) {
await page.click('#yw1 > li.next > a');
}
await page.waitFor(2000);
};
await browser.close();
}
getPic();
