Q:

How to use value from any element in my node js program?

Element (<input id="pagenum-input" class="form-control" aria-label="..." value="1" min="1" max="28">)

I want to use the Value of max(28) as value of variable maximum that i have created in 2nd loop. How i can get the value of max from input tag to my program? 
Any help would be appreciated. Thanks !
const puppeteer = require('puppeteer');

async function getPic() {
  const browser = await puppeteer.launch({headless: false});
  const page = await browser.newPage();

  for (let j=2; j<=6; j++) {
    await page.setViewport({width: 2000, height: 2500})
    await page.goto('http://epaper.freepressjournal.in/');
    await page.click('body > div > div.common_section > div > div > div.rw_rightcrousel > div > div:nth-child('+j+') > a > div > img');  
    await page.waitFor(2000);
    await page.click('#left-chunk-1 > img');
    var maximum; 
    for (let i= 1; i<=maximum; i++) {
      await page.waitFor(2000);
      await page.screenshot({path: '//192.168.2.19/em/automatic downloading/Puppeteer/freepressjournal/'+j+''+i+'.png'});
      await page.waitFor(2000);    
      await page.click('#page-div > a.right_arrow_pgright.btn_next');      
    }
  }

  await browser.close();
}

getPic();

// This loop will automatically get the value of max that is 28.
// The value of max will vary according to pages. The program should accept
// the value of max in maximum and run the loop accordingly.
for (let i= 1; i<=maximum; i++) 

A:

You can interact with any element on the page with the help of page.evaluate function. Here's how you can find the input element of interest and access one of its attributes:
var maximum = await page.evaluate(() => {
    return document.getElementById("pagenum-input").getAttribute("max");
});

