-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
67 lines (47 loc) · 1.9 KB
/
main.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
56
57
58
59
60
61
62
63
64
65
66
67
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
#from credentials import username, password
import config
import time
print(config.username, config.password)
username = config.username
password = config.password
service = Service(executable_path="chromedriver.exe")
driver = webdriver.Chrome(service=service)
driver.get("https://eam.indraweb.net/maximo/webclient/login/login.jsp")
# Login
WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.ID, "username"))
)
input_username = driver.find_element(By.ID, "username")
input_username.clear()
input_username.send_keys(username)
input_password = driver.find_element(By.ID, "password")
input_password.clear()
input_password.send_keys(password + Keys.ENTER)
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.ID, "mx8_ns_menu_WO_MODULE_a_tnode"))
)
nav_bar = driver.find_element(By.ID, "mx8_ns_menu_WO_MODULE_a_tnode")
nav_bar.click()
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.ID, "mx8_ns_menu_WO_MODULE_sub_changeapp_WO_TR_a_tnode"))
)
nav_bar_child = driver.find_element(By.ID, "mx8_ns_menu_WO_MODULE_sub_changeapp_WO_TR_a_tnode")
nav_bar_child.click()
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.XPATH, '//*[@id="mx20_tfrow_[C:4]_txt-tb"]'))
)
input_search = driver.find_element(By.XPATH, '//*[@id="mx20_tfrow_[C:4]_txt-tb"]') #CLIENTE
input_search.clear()
input_search.send_keys("=TMB")
time.sleep(1)
input_search2 = driver.find_element(By.XPATH, '//*[@id="mx20_tfrow_[C:14]_txt-tb"]') # CLASIFICACIÓN
input_search2.clear()
input_search2.send_keys("EXPENDEDORAS AUTOMÁTICAS DE BILLETES" + Keys.ENTER)
time.sleep(600)
driver.quit()