自动化进入页面后截图保存
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()
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()
生命不断追求不止