Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Archvo de configuracion xml
- //XmlDocument doc = new XmlDocument();
- //doc.PreserveWhitespace = true;
- //doc.Load("appConfig.xml");
- //-----------------------------varibale controladora del tiempo-----------------------------------//
- DateTime tiempoInicial = DateTime.Now;
- TimeSpan tiempoLimite = TimeSpan.ParseExact("00:06:00.1238983", "c", null);
- DateTime tiempoFinal;
- TimeSpan tiempoTotal;
- //-----------------------------variables Partes procesales---------------------------------------//
- string expediente = null;
- string organoJuris = null;
- string juez = null;
- DateTime? fechaInicio = null;
- string observacion = null;
- string materia = null;
- string etapaProcesal = null;
- string ubicacion = null;
- string sumilla = null;
- string distritojudi = null;
- string especialistaLegal = null;
- string proceso = null;
- string especialidad = null;
- string estado = null;
- string motivoConclusion = null;
- DateTime? fechaConclusion = null;
- //-----------------------variables partes procesales------------------------------------------------//
- string parte = null;
- string tipoPersona = null;
- string apellidoRazon = null;
- string apellidoMaterno = null;
- string nombres = null;
- //-------------------------variables de la actuacion ------------------------------------------------//
- DateTime? fechaResolucion = null;
- string resolucion = null;
- string tipoNotificacion = null;
- string sumillaAct = null;
- string descUsuario = null;
- string acto = null;
- string fojas = null;
- string proveido = null;
- DateTime? FechaIngreso = null;
- //-------------------- variables de la notificacion -----------------------------------------------//
- string nombreNotifi = null;
- string destinatario = null;
- DateTime? fechaEnvio = null;
- string anexo = null;
- string formaEntrega = null;
- //-----------------------variables de los detalles de la notificacion -------------------------------------------------//
- DateTime? fechaResolu = null;
- DateTime? notificacionImpresa = null;
- DateTime? enviadaCentral = null;
- DateTime? recepcionadaCentral = null;
- DateTime? notificacionDestinatario = null;
- DateTime? cargoDevuelto;
- string diasDesdeResolucionNotificacionImpresa = null;
- string diasDesdeResolucionEnviadaCentral = null;
- string diasDesdeResolucionRecepcionadaCentral = null;
- string diasDesdeResolucionNotificacionDestinatario = null;
- string diasDesdeResolucionCargoDevueltoJuzgado = null;
- //---------------------arreglo de paginas de la pagina----------------------------------------------------------------------//
- int[] ArregloPagi = new int[] { 2, 5, 8, 7, 8, 4, 5, 6, 7, 8 };
- int contPag = 0;
- //---------------------------------------------------------------------------------------------------------------------------//
- //------------------------------------variable para controlar el scroll de la pagina-------------------------------------------//
- Actions actions = new Actions(driver);
- //-----------------------------------------------------------------------------------------------------------------------------//
- List<ActuacionDto> actuaciones = new List<ActuacionDto>();
- List<NotificacionDto> notificaciones = new List<NotificacionDto>();
- List<PartesProcesalesDto> partesProcesales = new List<PartesProcesalesDto>();
- CasoExpedienteDto casoExpediente = new CasoExpedienteDto();
- if (objCasoConData != null)
- {
- actuaciones = objCasoConData.actuacion;
- partesProcesales = objCasoConData.partesPro;
- }
- ActuacionDto objAct;
- NotificacionDto objNot;
- ReporteExpedienteDto objRepo;
- var htmlDoc = new HtmlDocument();
- using (driver)
- {
- if (objCasoConData == null)
- {
- Thread.Sleep(2000);
- try
- {
- var html = driver.FindElementByXPath("//*[@id=\"divDetalles\"]").Text;
- }
- catch
- {
- Thread.Sleep(15000);
- }
- //En devolver un resultado entonces esto devuelve un delay para que no se pare la ejecucion
- string[] array = driver.FindElementByXPath("//*[@id=\"divCuerpo\"]/div[3]/div[1]/b").Text.Split(' ');
- int cantidad = Int32.Parse(array[5]);
- driver.FindElementByXPath("//*[@id=\"command\"]/button/img").Click();
- Thread.Sleep(1000);
- }
- string htmlPagina = driver.PageSource;
- htmlDoc.LoadHtml(htmlPagina);
- //*[@id="accordionX"]/div[3]
- //Aqui guardo el texto del div denominado en la pagina "reporte de expediente"
- //Extraccion de variables de la seccion resporte de expediente
- expediente = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[2]/b").Text;
- organoJuris = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[4]").Text;
- juez = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[8]").Text;
- string valorFechaInicio = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[12]").Text;
- if (DateTime.TryParse(valorFechaInicio, System.Globalization.CultureInfo.GetCultureInfo("es-PE"), System.Globalization.DateTimeStyles.None, out var fechaInicioDate))
- {
- fechaInicio = fechaInicioDate;
- }
- observacion = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[16]").Text;
- materia = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[20]").Text;
- etapaProcesal = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[24]").Text;
- ubicacion = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[28]").Text;
- sumilla = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[32]").Text;
- distritojudi = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[6]").Text;
- especialistaLegal = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[10]").Text;
- proceso = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[14]").Text;
- especialidad = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[18]").Text;
- estado = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[22]").Text;
- motivoConclusion = driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[30]").Text;
- try
- {
- fechaConclusion = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"gridRE\"]/div[26]").Text, "dd/MM/yyyy", null);
- }
- catch
- {
- Console.Write("La fecha conclusion no ha sido encontrada en este expediente \n");
- fechaConclusion = null;
- }
- objRepo = new ReporteExpedienteDto
- {
- NumeroExpediente = expediente,
- OrganoJurisdiccional = organoJuris,
- Juez = juez,
- FechaInicio = fechaInicio,
- Observacion = observacion,
- Materia = materia,
- Etapa = etapaProcesal,
- Ubicacion = ubicacion,
- Sumilla = sumilla,
- DistritoJudicial = distritojudi,
- EspecialistaLegal = especialistaLegal,
- Proceso = proceso,
- Especialidad = especialidad,
- Estado = estado,
- FechaConclusion = fechaConclusion,
- Existencia = true,
- MotivoConclusion = motivoConclusion
- };
- //------------------------------------------------------------------------------------------------------------//
- //----------extracción de datos de la sección de partes procesales -------------------------------------------//
- if (partesProcesales.Count == 0)
- {
- int numeroPartesProcesales = (htmlDoc.DocumentNode.SelectNodes("//div[@class='partes']").Count);
- PartesProcesalesDto objeto;
- for (int g = 2; g <= numeroPartesProcesales; g++)
- {
- try
- {
- parte = driver.FindElementByXPath("//*[@id=\"collapseTwo\"]/div/div[" + g + "]/div[1]").Text;
- }
- catch
- {
- Console.WriteLine("Este expediente no tiene partes procesales");
- break;
- }
- tipoPersona = driver.FindElementByXPath("//*[@id=\"collapseTwo\"]/div/div[" + g + "]/div[2]").Text;
- apellidoRazon = driver.FindElementByXPath("//*[@id=\"collapseTwo\"]/div/div[" + g + "]/div[3]").Text;
- try
- {
- apellidoMaterno = driver.FindElementByXPath("//*[@id=\"collapseTwo\"]/div/div[" + g + "]/div[4]").Text;
- }
- catch
- {
- Console.WriteLine("Esta parte procesal no tiene apellido materno");
- apellidoMaterno = null;
- }
- try
- {
- nombres = driver.FindElementByXPath("//*[@id=\"collapseTwo\"]/div/div[" + g + "]/div[5]").Text;
- }
- catch
- {
- Console.WriteLine("Esta parte procesal no tiene nombres");
- nombres = null;
- }
- objeto = new PartesProcesalesDto
- {
- parte = parte,
- tipoPersona = tipoPersona,
- apellidoRazon = apellidoRazon,
- apellidoMaterno = apellidoMaterno,
- nombres = nombres
- };
- partesProcesales.Add(objeto);
- }
- }
- //Aqui guardo el texto del div denominado en la pagina "Partes procesales" y en la siguiente linea lo guardo en un archivo de texto
- string prueba = driver.FindElementByXPath("//*[@id=\"paginacion1\"]").Text;
- string[] paginas = Regex.Split(prueba, "\n");
- int numeroPagin = (paginas.Length) - 2; //Aqui obtengo el numero de paginas de la seccion de "SEGUIMIENTO DEL DETALLE"
- Console.Write("Hay " + numeroPagin + " paginas para consultar \n");
- IWebElement botonDescargar;
- string verifyActuacion;
- int actuacionSiguiente;
- int cantActu;
- //---------------------------------En esta seccion encuentro la cantidad total de actuaciones--------------------------------------------------//
- int cantidadActuaciones = 0;
- int contador = 1;
- // TODO : ¿Como obtiene el numero de actuaciones?
- while (true)
- {
- try
- {
- cantidadActuaciones = cantidadActuaciones + htmlDoc.DocumentNode.SelectNodes("//div[@id='collapseThree']/div[@class='panel-body pnl-seg cpnlSeguimiento cpnlSeguimiento" + contador + "']").Count;
- contador++;
- }
- catch
- {
- break;
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------------------//
- int i = 1;
- //Es para que empieze a extraer datos desde donde habia quedado cuando se activo la excepcion de tiempo de sesion
- if (actuaciones.Count != 0)
- {
- int contPagina = 0;
- while (contPagina != numeroPaginador)
- {
- var paginador = driver.FindElementByXPath("//*[@id=\"paginacion2\"]/li[" + ArregloPagi[contPagina] + "]/a");
- ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", paginador);
- paginador.Click();
- Thread.Sleep(1000);
- contPagina++;
- }
- contPag = numeroPaginador;
- i = (objCasoConData.actuacion.Count) + 1;
- }
- for (; i <= cantidadActuaciones; i++)
- {
- FechaIngreso = null;
- fechaResolucion = null;
- notificaciones = new List<NotificacionDto>();
- try
- {
- FechaIngreso = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[1]/div[1]/div[2]").Text, "dd/MM/yyyy HH:mm", null);
- }
- catch
- {
- try
- {
- fechaResolucion = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[1]/div[1]/div[2]").Text, "dd/MM/yyyy", null);
- }
- catch
- {
- //TODO: El martes me explica porque rompe aqui el for cuando no encuentra fecha ingreso no fecha resolución
- break;
- }
- }
- IWebElement actuacion = null;
- if (NodoExist.existsElement(driver, out actuacion, "//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]"))
- {
- ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", actuacion);
- Thread.Sleep(150);
- //---------------------------------Extrae los datos de actuacion del expediente -----------------------------------------//
- resolucion = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[1]/div[2]/div[2]").Text;
- tipoNotificacion = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[1]/div[3]/div[2]").Text;
- sumillaAct = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[3]/div[1]/div[2]").Text;
- descUsuario = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[3]/div[2]/div[2]").Text;
- acto = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[2]/div[1]/div[2]").Text;
- fojas = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[1]/div[2]/div[2]/div[2]").Text;
- proveido = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/ div[2]/div/div[1]/div[2]/div[3]/div[2]").Text;
- botonDescargar = null;
- if (NodoExist.existsElement(driver, out botonDescargar, "//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div[1]/div[1]/div[4]/div[1]"))
- {
- if (botonDescargar.Text == "DESCARGAR")
- {
- driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div[1]/div[1]/div[4]/div[1]").Click();
- if (i == cantidadActuaciones)
- {
- Thread.Sleep(5000);
- }
- Console.Write("La actuacion numero " + i + " SI tiene documento disponible para descargar \n");
- }
- else
- {
- Console.Write("La actuacion numero " + i + " NO tiene documento disponible para descargar \n");
- }
- }
- else
- {
- Console.Write("La actuacion numero " + i + " NO tiene documento disponible para descargar \n");
- }
- IWebElement verificacionExistenciaNotificacion = null;
- if (NodoExist.existsElement(driver, out verificacionExistenciaNotificacion, "//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div[1]/div[2]"))
- {
- //Verificamos si hay notificaciones
- if (string.IsNullOrWhiteSpace(driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div[1]/div[2]").Text) == false)
- {
- Console.Write("La actuacion numero " + i + " SI tiene notificaciones \n");
- int numeroNotificacionesActuacion = htmlDoc.DocumentNode.SelectNodes("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[2]/div[@class='panel-body']").Count;
- for (int k = 1; k <= numeroNotificacionesActuacion; k++)
- {
- IWebElement notificacion = null;
- if (NodoExist.existsElement(driver, out notificacion, "//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[2]/div[" + k + "]"))
- {
- ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", notificacion);
- Thread.Sleep(300);
- IWebElement nombreNotifiExiste = null;
- IWebElement destinatarioExistente = null;
- IWebElement fechaEnvioExistente = null;
- IWebElement anexoExistente = null;
- if (NodoExist.existsElement(driver, out nombreNotifiExiste, "//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[2]/div[" + k + "]/div/h5"))
- {
- if (!string.IsNullOrWhiteSpace(nombreNotifiExiste.Text))
- {
- nombreNotifi = nombreNotifiExiste.Text;
- }
- else
- {
- nombreNotifi = null;
- }
- }
- if (NodoExist.existsElement(driver, out destinatarioExistente, "//*[@id=\"pnlSeguimiento" + i + "\"]/ div[2]/div/div[2]/div[" + k + "]/div/div[1]/div[1]/div[2]"))
- {
- if (!string.IsNullOrWhiteSpace(destinatarioExistente.Text))
- {
- destinatario = destinatarioExistente.Text;
- }
- else
- {
- destinatario = null;
- }
- }
- if (NodoExist.existsElement(driver, out fechaEnvioExistente, "//*[@id=\"pnlSeguimiento" + i + "\"]/ div[2]/div/div[2]/div[" + k + "]/div/div[1]/div[2]/div[2]"))
- {
- if (!string.IsNullOrWhiteSpace(fechaEnvioExistente.Text))
- {
- fechaEnvio = DateTime.ParseExact(fechaEnvioExistente.Text, "dd/MM/yyyy HH:mm", null);
- }
- else
- {
- fechaEnvio = null;
- }
- }
- if (NodoExist.existsElement(driver, out anexoExistente, "//*[@id=\"pnlSeguimiento" + i + "\"]/ div[2]/div/div[2]/div[" + k + "]/div/div[2]/div[1]/div[2]"))
- {
- if (string.IsNullOrWhiteSpace(anexoExistente.Text))
- {
- anexo = anexoExistente.Text;
- }
- else
- {
- anexo = null;
- }
- }
- try
- {
- formaEntrega = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[2]/div[" + k + "]/div/div[2]/div[2]/div[2]").Text;
- }
- catch
- {
- formaEntrega = null;
- }
- var botonDeta = driver.FindElementByXPath("//*[@id=\"pnlSeguimiento" + i + "\"]/div[2]/div/div[2]/div[" + k + "]/div/div[3]/div/button");
- botonDeta.Click();
- Thread.Sleep(300);
- //Se guardan los detalles de las notificaciones
- //Las excepciones son el caso de que no encuentre el dato y no interrumpa la ejecucion del programa
- try
- {
- fechaResolu = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/div/div[2]/div/div/div[3]/div[2]/div[1]/div[2]").Text, "dd/MM/yyyy", null);
- }
- catch
- {
- Console.WriteLine("La fecha de resolución no existe en esta notificación \n");
- fechaResolu = null;
- }
- try
- {
- notificacionImpresa = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[3]/div[2]/div[2]/div[2]").Text, "dd/MM/yyyy", null);
- diasDesdeResolucionNotificacionImpresa = driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/div/div[2]/div/div/div[3]/div[2]/div[2]/div[3]").Text;
- }
- catch
- {
- Console.WriteLine("La notificacion Impresa no existe en esta notificación \n");
- notificacionImpresa = null;
- diasDesdeResolucionNotificacionImpresa = "";
- }
- try
- {
- enviadaCentral = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/div/div[2]/div/div/div[3]/div[2]/div[3]/div[2]").Text, "dd/MM/yyyy", null);
- diasDesdeResolucionEnviadaCentral = driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/div/div[2]/div/div/div[3]/div[2]/div[3]/div[3]").Text;
- }
- catch
- {
- Console.WriteLine("La Enviada a la Central de Notificación o Casilla Electrónica: no existe en esta notificación \n");
- enviadaCentral = null;
- diasDesdeResolucionEnviadaCentral = "";
- }
- try
- {
- recepcionadaCentral = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[3]/div[2]/div[4]/div[2]").Text, "dd/MM/yyyy", null);
- diasDesdeResolucionRecepcionadaCentral = driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[3]/div[2]/div[4]/div[3]").Text;
- }
- catch
- {
- Console.WriteLine("La Recepcionada en la central de Notificación no existe en esta notificación \n");
- recepcionadaCentral = null;
- diasDesdeResolucionRecepcionadaCentral = "";
- }
- try
- {
- notificacionDestinatario = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[4]/div[2]/div[1]/div[2]").Text, "dd/MM/yyyy", null);
- diasDesdeResolucionNotificacionDestinatario = driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[4]/div[2]/div[1]/div[3]").Text;
- }
- catch
- {
- Console.WriteLine("La Notificacion al destinatario no existe en esta notificación \n");
- notificacionDestinatario = null;
- diasDesdeResolucionNotificacionDestinatario = "";
- }
- try
- {
- cargoDevuelto = DateTime.ParseExact(driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[4]/div[2]/div[2]/div[2]").Text, "dd/MM/yyyy", null);
- diasDesdeResolucionCargoDevueltoJuzgado = driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/ div/div[2]/div/div/div[4]/div[2]/div[2]/div[3]").Text;
- }
- catch
- {
- Console.WriteLine("La cargo devuelto no existe en esta notificación \n");
- cargoDevuelto = null;
- diasDesdeResolucionCargoDevueltoJuzgado = "";
- }
- driver.FindElementByXPath("//*[@id=\"modal-dialog-" + i + "-" + k + "\"]/div/div[2]/div/div/div[6]/div[2]/button").Click();
- // En esta parte creo el objeto le seteo los valores necesario y luego lo agrego en la List de notificaciones
- objNot = new NotificacionDto
- {
- nombre = nombreNotifi,
- destinatario = destinatario,
- fechaEnvio = fechaEnvio,
- anexos = anexo,
- formaEntrega = formaEntrega,
- fechaResolucion = fechaResolu,
- notificacionImpresa = notificacionImpresa,
- enviadaCentralNotificacion = enviadaCentral,
- RecepcionadaCentral = recepcionadaCentral,
- CargoDevueltoJuzgado = cargoDevuelto,
- diasDesdeResolucionCargoDevueltoJuzgado = diasDesdeResolucionCargoDevueltoJuzgado,
- diasDesdeResolucionNotificacionDestinatario = diasDesdeResolucionNotificacionDestinatario,
- diasDesdeResolucionRecepcionadaCentral = diasDesdeResolucionRecepcionadaCentral,
- diasDesdeResolucionNotificacionImpresa = diasDesdeResolucionNotificacionImpresa,
- diasDesdeResolucionEnviadaCentral = diasDesdeResolucionEnviadaCentral
- };
- notificaciones.Add(objNot);
- }
- else
- {
- Console.WriteLine("La actuacion numero {0} tiene {1} de notificaciones", i, (k - 1));
- break;
- }
- }
- }
- }
- else
- {
- Console.Write("La actuacion numero " + i + " NO tiene notificaciones \n");
- }
- objAct = new ActuacionDto
- {
- fechaResolucion = fechaResolucion,
- resolucion = resolucion,
- tipoNotificacion = tipoNotificacion,
- sumilla = sumillaAct,
- descUsuario = descUsuario,
- acto = acto,
- fojas = fojas,
- proveido = proveido,
- notificaciones = notificaciones,
- FechaIngreso = FechaIngreso
- };
- actuaciones.Add(objAct);
- casoExpediente.reporteExp = objRepo;
- casoExpediente.partesPro = partesProcesales;
- casoExpediente.actuacion = actuaciones;
- //En la siguientes lineas verifico si hay mas actuaciones por revizar
- actuacionSiguiente = i + 1;
- IWebElement actuacionVerificacion = null;
- if (NodoExist.existsElement(driver, out actuacionVerificacion, "//*[@id=\"pnlSeguimiento" + actuacionSiguiente + "\"]/div[2]"))
- {
- ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", actuacionVerificacion);
- verifyActuacion = driver.FindElementById("pnlSeguimiento" + actuacionSiguiente).Text;
- if (verifyActuacion == "")
- {
- tiempoFinal = DateTime.Now;
- //Crea un "intervalo temporal"
- tiempoTotal = new TimeSpan(tiempoFinal.Ticks - tiempoInicial.Ticks);
- if (contPag == ArregloPagi.Length + 1) contPag = 6;
- var paginador = driver.FindElementByXPath("//*[@id=\"paginacion2\"]/li[" + ArregloPagi[contPag] + "]/a");
- Thread.Sleep(300);
- paginador.Click();
- Thread.Sleep(300);
- contPag++;
- if (tiempoTotal >= tiempoLimite && casoExpediente.actuacion.Count != cantidadActuaciones)
- {
- try
- {
- driver.Navigate().Refresh();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- extraccionDatos(driver, casoExpediente, (contPag));
- }
- }
- }
- else
- {
- if (casoExpediente.actuacion.Count == cantidadActuaciones)
- {
- Console.WriteLine("Se han extraido todas las actuaciones sin excepcion \n");
- return casoExpediente;
- }
- else
- {
- // Si no concuerdan la cantidad de actuaciones con las extraidas vuelve a extraerlas para que cumpla la condicion que sean todas las actuaciones
- driver.Navigate().Refresh();
- extraccionDatos(driver);
- }
- Console.WriteLine("Se ha finalizado la extracción de datos de este expediente \n");
- break;
- }
- }
- else
- {
- cantActu = i;
- }
- }
- return casoExpediente;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement