自动化进入页面后截图保存

from selenium import webdriver

from time import sleep

from selenium.webdriver.common.by import By
# 通过ID来定位
driver = webdriver.Chrome()
driver.maximize_window()
driver.get('http://www.baidu.com')
sleep(3)
driver.find_element(By.ID, 'kw').send_keys("极客时间")
driver.find_element(By.ID, "su").click()
sleep(3)
driver.get_screenshot_as_file('1.结尾截图.png')

sleep(3)
driver.quit()
 

 

posted @ 2023-08-14 00:55  生命不止追求不断  阅读(13)  评论(0编辑  收藏  举报