python pyppeteer util 设置标签页面的大小

async def setPage(page): #传入要设置的页面对象即可
    width, height = screen_size()
    await page.setViewport({'width': width, 'height': height})
    await page.evaluateOnNewDocument('Object.defineProperty(navigator,"webdriver",{get:()=>undefined})')

def screen_size():
    import tkinter
    tk = tkinter.Tk()
    width = tk.winfo_screenwidth()
    height = tk.winfo_screenheight()
    tk.quit()
    return width, height
上一篇:编写输出Hellow word!


下一篇:算子map