龙空技术网

Python chrome 自动化截图 输入网址的list就好了

Fly6 135

前言:

此刻朋友们对“python截图网页”都比较关心,朋友们都想要了解一些“python截图网页”的相关文章。那么小编在网络上汇集了一些关于“python截图网页””的相关资讯,希望看官们能喜欢,小伙伴们一起来了解一下吧!

from selenium import webdriverimport timeimport csvwith open('/Users/apple/py_l_gp/pachong/wangzhanjietu/spider西藏.csv', encoding="utf-8") as f:    reader = csv.reader(f)    # print(reader)    # print(list(reader))    for i in reader:        driver = webdriver.Chrome()        print(i[1])        if(i[1]!="link"):            driver.get(i[1])             # driver.get(";)            driver.maximize_window()                        try:                picture_url = driver.save_screenshot('./'+i[1][7:]+'ss.png')                print("%s :截图成功!!!" % picture_url)            except BaseException as msg:                print("%s :截图失败!!!" % msg)            driver.quit()

标签: #python截图网页