I'm receiving an error that says "puppeteer is not defined" when it is clearly in the only javaScript file.
How do i get the JavaScript/single page html project to recognize the puppeteer module? I have already looked into this potential answer;[Nodejs. Proper way to include modules, however it does not help.
(The goal is to launch the html page, enter a url from booking.com, click the button, and have the scraped hotel name, rating, etc returned in the console)
app.js
function main()
{
var Url = document.getElementById('inputUrl').value
const puppeteer = require('puppeteer');
let bookingUrl = Url;
(async () => {
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto(bookingUrl);
await page.waitForSelector('div.sr_property_block[data-hotelid]');
let hotelData = await page.evaluate(() => {
...
...
...
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="app.js" type="text/javascript"></script>
<meta name="description" content="">
<link rel="stylesheet" href="">
</head>
<body>
<input id = "inputUrl" type="text" placeholder = "type url here"/>
<button id = "button" button onclick="main();"> click</button>
</body>
</html>