def inicio_sesion_dropbox(self, webdriver_test_ux: WebDriver, json_eval, json_args, url_login): intentos_ingreso_password_gmail = 0 tiempo_step_inicio = None fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() if not UtilsEvaluaciones.se_ingreso_correctamente_a_la_pagina_principal( json_eval): json_eval = UtilsEvaluaciones.generar_json_inicio_de_sesion_incorrecta( json_eval, tiempo_step_inicio, fecha_inicio, 1, constantes_evaluaciones_claro_drive. MSG_INICIO_SESION_FALLIDA_POR_INGRESO_DE_PAGINA) return json_eval try: btn_inicio_sesion = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 6, xpath='//button[@class="auth-google button-primary"]') HtmlActions.click_html_element( btn_inicio_sesion, xpath='//button[@class="auth-google button-primary"]') if ValidacionesHtml.se_encuentran_mas_ventanas_en_sesion( webdriver_test_ux, 6): ventana_padre = webdriver_test_ux.window_handles[0] ventana_hija = webdriver_test_ux.window_handles[1] webdriver_test_ux.switch_to.window(ventana_hija) modo_no_grafico = FormatUtils.lector_archivo_ini().getboolean( 'Driver', 'headless') # input_user = HtmlActions.webdriver_wait_element_to_be_clickable(webdriver_test_ux, 6, id='identifierId') # # HtmlActions.enviar_data_keys(input_user, json_args['user']) # # btn_siguiente = HtmlActions.webdriver_wait_element_to_be_clickable(webdriver_test_ux, 6, id='identifierNext') # # HtmlActions.click_html_element(btn_siguiente, id='identifierNext') # # time.sleep(10) btn_usuario = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 6, xpath='//div[@data-email="{}"]'.format(json_args['user'])) time.sleep(2) HtmlActions.click_html_element( btn_usuario, xpath='//div[@data-email="{}"]'.format(json_args['user'])) tiempo_step_inicio = Temporizador.obtener_tiempo_timer() webdriver_test_ux.switch_to.window(ventana_padre) HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 18, class_name='maestro-portal') json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, True, constantes_evaluaciones_claro_drive. MSG_OUTPUT_INICIO_SESION_EXITOSO) except ElementNotInteractableException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) except NoSuchElementException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) except TimeoutException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) except ElementClickInterceptedException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) json_eval = UtilsEvaluaciones.finalizar_tiempos_en_step( json_eval, 1, tiempo_step_inicio, fecha_inicio) return json_eval
def inicio_sesion_claro_drive(webdriver_test_ux: WebDriver, json_eval, argumentos_json): tiempo_step_inicio = None fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() # verifica que se haya iniciado sesion correctamente if not UtilsEvaluaciones.se_ingreso_correctamente_a_la_pagina_principal( json_eval): json_eval = UtilsEvaluaciones.generar_json_inicio_de_sesion_incorrecta( json_eval, tiempo_step_inicio, fecha_inicio, 1, const_claro_drive. MSG_OUTPUT_INICIO_SESION_MSG_ERROR_INGRESO_PAGINA_PRINCIPAL) return json_eval try: btn_inicio_sesion = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 6, id=const_claro_drive.INICIO_SESION_ID_INPUT_LOGIN) HtmlActions.click_html_element( btn_inicio_sesion, id=const_claro_drive.INICIO_SESION_ID_INPUT_LOGIN) input_email = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 6, class_name=const_claro_drive. INICIO_SESION_CLASS_NAME_INPUT_EMAIL) HtmlActions.enviar_data_keys( input_email, data_key=argumentos_json[const_claro_drive.JSON_ARG_USER], class_name=const_claro_drive. INICIO_SESION_CLASS_NAME_INPUT_EMAIL) input_password = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 6, class_name=const_claro_drive. INICIO_SESION_CLASS_NAME_INPUT_PASSWORD) input_password.send_keys( argumentos_json[const_claro_drive.JSON_ARG_PASSWORD]) btn_ingreso_cuenta = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 6, xpath=const_claro_drive.INICIO_SESION_XPATH_BTN_INICIAR_SESION) HtmlActions.click_html_element( btn_ingreso_cuenta, xpath=const_claro_drive.INICIO_SESION_XPATH_BTN_INICIAR_SESION) # inicia el tiempo de inicio tiempo_step_inicio = Temporizador.obtener_tiempo_timer() HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 120, class_name=const_claro_drive. INICIO_SESION_CLASS_NAME_BTN_CREATE_RESOURCE) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, True, const_claro_drive.MSG_OUTPUT_INICIO_SESION_EXITOSO) except ElementNotInteractableException as e: msg_output = const_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO. \ format(e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) except NoSuchElementException as e: msg_output = const_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO. \ format(e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) except TimeoutException as e: msg_output = const_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO. \ format(e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) except StaleElementReferenceException as e: msg_output = const_claro_drive.MSG_OUTPUT_INICIO_SESION_SIN_EXITO. \ format(e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 1, 0, False, msg_output) json_eval = UtilsEvaluaciones.finalizar_tiempos_en_step( json_eval, 1, tiempo_step_inicio, fecha_inicio) return json_eval