当前位置:首页 > 编程 > 正文

playwright 隐藏webdrive

from playwright.sync_api import sync_playwright
import time

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()
    page.add_init_script(path='D:\Python37\Scripts\stealth.min.js') # 加载JS文件 防止被检测到
    page.goto("https://bot.sannysoft.com/")
    time.sleep(3)
    page.screenshot(path='scree.jpg')

    browser.close()


发表评论