编程语言
首页 > 编程语言> > python pyppeteer util 设置标签页面的大小

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

标签:winfo,python,pyppeteer,height,util,width,tk,page,size
来源: https://blog.csdn.net/weixin_55399173/article/details/121375326