截图

截图

#!/usr/bin/python3
from selenium import webdriver
import time

chrome = webdriver.Chrome()
chrome.maximize_window()
chrome.get('https://www.baidu.com')
# 截图1
chrome.save_screenshot('baidu1.png')
# 截图2
chrome.get_screenshot_as_file('./baidu2.png')
# 截图3
baidu3 = chrome.get_screenshot_as_png()
with open('baidu3.png','wb') as f:
    f.write(baidu3)

time.sleep(5)
posted @ 2020-06-07 01:40  静心&得意  阅读(148)  评论(0编辑  收藏  举报