Detect web page running in puppeteer
Puppeteer use headless chrome with this ua: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/101.0.4950.0 Safari/537.36
We can check the special string HeadlessChrome
to detect
/HeadlessChrome/.test(navigator.userAgent);