在尝试了各种方法之后……我偶然发现了这个页面,用chromedriver,selenium和python进行了全页截图.
原始代码是here.(我在下面的帖子中复制代码)
它使用PIL,效果很好!但是,有一个问题……它捕获整个页面的固定标题和重复,并在页面更改期间错过页面的某些部分.示例网址截取屏幕截图:
如何避免使用此代码重复标头…或者是否有更好的选项只使用python …(我不知道java,不想使用java).
请参阅下面的当前结果和示例代码的屏幕截图.
test.py
"""
This script uses a simplified version of the one here:
https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/
It contains the *crucial* correction added in the comments by Jason Coutu.
"""
import sys
from selenium import webdriver
import unittest
import util
class Test(unittest.TestCase):
""" Demonstration: Get Chrome to generate fullscreen screenshot """
def setUp(s