Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 599 Bytes

2019-01-27-hide-navigator-webdriver.md

File metadata and controls

20 lines (16 loc) · 599 Bytes
title tags force_publish_time force_update_time
隐藏 navigator.webdriver
踩坑
2019-01-26 16:28:33 UTC
2019-01-26 16:30:18 UTC

Source: https://intoli.com/blog/not-possible-to-block-chrome-headless/

TL;DR

Object.defineProperty(navigator, 'webdriver', {
  get: () => false,
});

Motivation

N/A

要用 Puppeteer 爬淘宝。然而只要有一点自动化测试的意思,Chrome 就会把 navigator.webdriver 设置成 true。淘宝的登陆页面会判断这个属性。