from selenium import webdriver from PIL import Image # 可能需要pip install Pillow from io import BytesIO
主要代码:
# 查找元素的方法可随意替换 image_data = driver.find_element_by_class_name('指定class元素名').screenshot_as_png im = Image.open(BytesIO(image_data)) im.save('./data/screen/screen1.png')
本文由 爱分享 原创编译,转载请注明出处:http://www.90tec.com/python/96.html