-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
58 lines (45 loc) · 1.79 KB
/
app.py
File metadata and controls
58 lines (45 loc) · 1.79 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Teste completo da automação Microsoft Forms
"""
import sys
import os
# Adicionar o diretório src ao path
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
from form_automation import FormAutomation
def test_full_automation():
"""Testar automação completa"""
form_url = "https://forms.office.com/pages/responsepage.aspx?id=Q6pJbyqCIEyWcNt3AL8esLOeSofjsRxAvgRIQVYNlxJURFpFREtLWjhKODlZMDBZS09QTkhJNU82QyQlQCN0PWcu&route=shorturl"
data_file = "data/teste-7-campos.csv"
print("🚀 Iniciando teste completo da automação Microsoft Forms...")
automation = None
try:
# Criar automação
automation = FormAutomation(
headless=False, # Modo visual para acompanhar
log_callback=lambda msg, level="INFO": print(f"[{level}] {msg}"),
progress_callback=lambda value, text="": print(f"📊 Progresso: {value}% - {text}"),
status_callback=lambda **kwargs: print(f"📈 Status: {kwargs}")
)
print("🎯 Executando automação completa...")
# Executar automação completa
result = automation.run_full_automation(
form_url=form_url,
data_file=data_file,
auto_submit=True # Submeter automaticamente e processar todas as linhas
)
print(f"\n🎉 AUTOMAÇÃO CONCLUÍDA!")
print(f"📊 Resultado:")
for key, value in result.items():
print(f" {key}: {value}")
except Exception as e:
print(f"\n❌ ERRO: {str(e)}")
import traceback
traceback.print_exc()
finally:
if automation:
input("\nPressione Enter para fechar o navegador...")
automation.close()
if __name__ == "__main__":
test_full_automation()