Commit 548a2151 by Javier

Tarifa

parent 31c75d8d
...@@ -5,6 +5,9 @@ from selenium.webdriver.support import expected_conditions as EC ...@@ -5,6 +5,9 @@ from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from enum import Enum
import time import time
magnus = "http://192.168.2.56/mbilling/" magnus = "http://192.168.2.56/mbilling/"
...@@ -13,16 +16,44 @@ login = { ...@@ -13,16 +16,44 @@ login = {
'password' : 'NgtAtONgeRaFtsbu', 'password' : 'NgtAtONgeRaFtsbu',
} }
class Tarifa(Enum):
ESTANDAR = 'Tarifa Estándar'
EMPRESA = 'Tarifa Empresas'
PLANA1000 = 'Bono PTV'
PLANA2000 = 'Bono PTV'
def authenticate(driver : webdriver.Firefox): def authenticate(driver : webdriver.Firefox):
driver.get(magnus) driver.get(magnus)
WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="textfield-1013-inputEl"]'))).send_keys(login['user']) WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="textfield-1013-inputEl"]'))).send_keys(login['user'])
driver.find_element(By.XPATH,'//*[@id="textfield-1014-inputEl"]').send_keys(login['password'], Keys.ENTER) driver.find_element(By.XPATH,'//*[@id="textfield-1014-inputEl"]').send_keys(login['password'], Keys.ENTER)
def add_new_user(driver : webdriver.Firefox, telefono : str): try:
WebDriverWait(driver,5).until(EC.element_to_be_clickable((By.XPATH, ' //*[@id="tool-1031-toolEl"]'))).click()
except TimeoutException:
pass
def add_new_user(driver : webdriver.Firefox, telefono : str, tarifa : Tarifa = Tarifa.ESTANDAR):
# Acceso a Panel # Acceso a Panel
WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="treeview-1176-record-10"]'))).click() WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="treeview-1176-record-10"]'))).click()
WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="button-1270"]'))).click() WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="button-1270"]'))).click()
WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="textfield-1291-inputEl"]'))).clear().send_keys(telefono)
# Usuario
username = WebDriverWait(driver,3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="textfield-1291-inputEl"]')))
username.clear()
username.send_keys(telefono)
driver.find_element(By.XPATH, '//*[@id="groupusercombo-1293-trigger-picker"]').click()
driver.find_element(By.XPATH, '//ul[@data-ref="listEl"]/li[text()="Cliente"]').click()
# Tarifa
driver.find_element(By.XPATH, '//*[@id="button-1297"]').click()
tarifa = WebDriverWait(driver,3).until(EC.element_to_be_clickable(
(By.XPATH, f'//*[contains(@id,"tableview")]//table//div[text()="{tarifa.value}"]'))
)
ActionChains(driver).double_click(tarifa).perform()
driver.find_element(By.XPATH, '//*[@id="button-1403"]').click()
# Datos Personales
driver.find_element(By.XPATH, '//*[@id="tab-1357-btnInnerEl"]').click()
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment