截图
#!/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)