nadavshkoori
nadavshkoori

Reputation: 11

Puppeteer blocked as robot with headless: true but not blocked with headless: false

I have a script that should open a headless browser, make a search, and take a screenshot.

When I'm running the script with headless: false, everything works.

When I'm running it with headless: true, I get blocked by the website (captcha).

I know that there are ways to bypass captchas but that's not what I want.

My question is what's the difference between these 2 modes that the website recognize me as headless browser but when it's not headless it doesn't.

Things I've tried:

'--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
'--window-size=1920,1080',
'--no-sandbox',
'--disable-gpu',
'--no-zygote',
'--disable-setuid-sandbox',
'--disable-accelerated-2d-canvas',
'--disable-dev-shm-usage'

I'm using latest puppeteer version(10.1.0), 'puppeteer-extra-plugin-stealth' and 'puppeteer-extra'.

Upvotes: 1

Views: 1801

Answers (1)

Xin
Xin

Reputation: 36600

Headless false:

This will be normal Auto UI test, which it launch the chrome browser, and you can see that the chrome browser window is open

Headless true:

Think of everything is running as UI TEST. However, this time it does not open the chrome browser physically, it only runs in command line, so no chrome window is open this time. This is very handy where you do not want to see in automatic running environment.

Upvotes: -1

Related Questions