-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaptura.py
More file actions
31 lines (21 loc) · 836 Bytes
/
captura.py
File metadata and controls
31 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
# -*- coding: utf-8 -*-
#DOCUMENTACION
#https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.chrome.webdriver
from datetime import datetime
from selenium import webdriver
import time
DRIVER = 'C:\chromedriver.exe'
op1 = input("Cuántas capturas de pantalla necesitas?: ")
op2 = input("Cuánto tiempo necesitas que espere para tomar cada captura?: ")
op3 = input("Cuál es el sitio al que le tomaré la captura?: http://")
for i in range(0,int(op1),1):
driver = webdriver.Chrome(DRIVER)
driver.maximize_window()
driver.get('http://%s' % op3)
time.sleep(int(op2))
now = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
screenshot = driver.save_screenshot('Captura-%s.png' %now)
driver.quit()
print("Captura",i+1," completada")
print("Se ha guardado con éxito")