以网页 http://www.haosimple.com/ 为例
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('http://www.haosimple.com/')
content = browser.page_source
print(len(content))
browser.close()
----------------------------------------------
out:14335
pyppeteer需要采用异步操作
import asyncio
import nest_asyncio
nest_asyncio.apply()
import pyppeteer
from pyppeteer import launch
async def main():
browser = await launch()
page = await browser.newPage()
await page.goto("http://www.haosimple.com/")
content = await page.content()
print(len(content))
asyncio.run(main())
--------------------------------
out:14358