pyppeteer登陆淘宝

import asyncio
from pyppeteer import launch

width, height = 2000, 1000

async def main():
    browser = await launch(headless=False, userDataDir='./userdata', args=[f'--window-size={width},{height}', '--disable-infobars'])
    page = await browser.newPage()
    await page.setViewport({'width': width, 'height': height})
    await page.goto('https://login.taobao.com/member/login.jhtml?redirectURL=https://www.taobao.com/')
    await page.evaluate('''() =>{ Object.defineProperties(navigator,{ webdriver:{ get: () => false } }) }''')
    await asyncio.sleep(100)

asyncio.get_event_loop().run_until_complete(main())

 

你可能感兴趣的:(pyppeteer登陆淘宝)