I want to capture web screen every time and save as the desired file name .
I still need to study a lot about Python, but I've looked through a lot of documents I'm asking this question because I think it'll be a copy-and-paste study.
Of course, studying other items is important, but the question I want to ask is
I wonder what kind of items I should focus on. (Related to import)
2020.08.11.1955 Add Minute
from PIL import ImageGrab
import time
now = time.localtime()
time = "%04d-%02d-%02d-%02dh-%02dm-%02ds" % (now.tm_year, now.tm_mon, now.tm_mday, now.tm_hour, now.tm_min, now.tm_sec)
img = ImageGrab.grab()
saveas="{}{}".format(time,'.png')
img.save(saveas)
So far, I've made this much. You have to access the URL you want here, and I want to save it by specifying the desired time, folder location, and file name. I would appreciate it if you could tell me how to study in the relevant module or import.
python
is simple : to use a selenium
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome('chromedriver', chrome_options=options)
driver.get('http://www.google.com/')
driver.save_screenshot('screen.png')
© 2024 OneMinuteCode. All rights reserved.