pyppeteer
是Python接口的puppeteer
,用来操作chrome浏览器,比传统的selenium 更好用。
我想把网页拖到底部,scroll page down,在网上找各种方法。
第一种如下:
Is there a way to scroll to end of page in pyppeteer · Issue #205 · miyakogi/pyppeteer
await page.evaluate("""{window.scrollBy(0, document.body.scrollHeight);}""")
可惜对我没用。
第二种如下:
python 3.x - Is there a way to scroll to end of page in pyppeteer - Stack Overflow
await page.hover(".class name")
对我也没用。
第三种方法如下:
page.scroll()? · Issue #305 · puppeteer/puppeteer
await page.evaluate('_ => {window.scrollBy(0, window.innerHeight);}')
对我有用。