"""
翻页截图整个页面
"""
page_width = web_driver.execute_script("return document.body.scrollWidth")
page_height = web_driver.execute_script("return document.body.scrollHeight")
web_driver.execute_cdp_cmd('Emulation.setDeviceMetricsOverride',
{'mobile': False, 'width': page_width, 'height': page_height,
'deviceScaleFactor': 1})
res = web_driver.execute_cdp_cmd('Page.captureScreenshot', {'fromSurface': True})
img_base64 = res['data']
web_driver.execute_cdp_cmd('Emulation.clearDeviceMetricsOverride', {})
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17