【发布时间】:2020-03-09 01:25:17
【问题描述】:
当使用puppeteer通过for-loop抓取一堆网站时,每当创建新页面时,浏览器都会跳转到前台,这会妨碍我在计算机上做其他事情。
即使我设置了以下参数,它仍然不起作用,所以我怎样才能让浏览器安静地运行而不跳转到前台并打断我呢?
我需要在headful 模式下运行,而不是headless 模式。
headless: false,
args: [
'--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',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding',
]
【问题讨论】: