'''
get_screenshot_as_file() ://as follow
'''
from selenium import webdriver
from time import sleep
driver= webdriver.Firefox()
driver.get('http://www.baidu.com')
driver.find_element_by_id('kw').send_keys('screenshot')
driver.find_element_by_id('su').click()
# screenshot from current window,and specify save location of the photo
driver.get_screenshot_as_file('D:\\pyse\\baidu_img.jpg')
driver.quit()
网友评论