-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAutomation.py
55 lines (41 loc) · 2.23 KB
/
Automation.py
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
import time
#import tkinter as tk
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
while True:
options = webdriver.ChromeOptions()
#options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)
url = "https://ca.grupocarbel.com.br/SSM/Account/LogOn?opcao=logoff"
driver.get(url)
time.sleep(1)
buton = driver.find_elements(By.ID,"UserName")
buton[0].send_keys("cesar.emc")
buton = driver.find_elements(By.ID,"Key")
buton[0].send_keys("!Grupo@2001")
time.sleep(1)
buton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID,"btnContinuar")))
buton.click()
buton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID,"buscaRapida")))
buton.send_keys(822642)
buton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH,"//input[@onclick='buscaRapida();']")))
buton.click()
buton = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "//span[@id='Realizar']")))
buton.click()
buton = WebDriverWait(
driver, 10).until(EC.presence_of_element_located((By.XPATH,"//input[@name='StatusDaAtividadeDoChamadoTipoDeStatusDeAtividadeId_input' and @class='k-input']")))
buton.click()
buton.send_keys("Solucionar Chamado")
# --- Finalização d chamado, já na tela de solucionar
buton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH,"//textarea[@name='DescricaoStatusDaAtividade']")))
buton.send_keys("""Boa tarde Alexandro!
Realizado varias tentativas de contato sem sucesso, caso seja necessário tratativa de falha em acessar o site do Dealer, gentileza
abrir um novo chamado com um numero de contato válido e disponibilidade para traatativa.""")
buton = WebDriverWait(
driver,10).until(EC.presence_of_element_located((By.XPATH,"//span[@id='Salvar' and @data-i18n='Salvar' and @comando='Salvar' and text()='Salvar']")))
buton.click()
time.sleep(100)
break