public void DosGrupoFamiliar() { IWebElement[] list = new IWebElement[] { BtnCpfFrente, BtnResidencia }; try { for (int cont = 0; cont < 2; cont++) { //string path = ""; Thread.Sleep(3000); util.WaitForElementVisible(list[cont], 15); if (list[cont].Displayed) { //path = @"C:\Users\leonardo.barcellos\Desktop\Imagens\teste.jpg"; util.ScrollElementoPage(list[cont]); Thread.Sleep(1500); list[cont].Click(); Thread.Sleep(1300); IWebElement enviar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='modal-dialog']//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//a[1]")); util.ScrollElementoPage(enviar); enviar.Click(); Thread.Sleep(1300); //SendKeys.SendWait(path); //SendKeys.SendWait(@"{Enter}"); Thread.Sleep(1300); IWebElement Confirm = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='modal-dialog']//div/./div[3]//button[1]")); Thread.Sleep(1300); Confirm.Click(); } } } catch { } }
public void ScrollPage(int num) { int scroll = num * 300; js = (IJavaScriptExecutor)ClassDriver.GetInstance().Driver; js.ExecuteScript("window.scrollBy(0, " + scroll + ")", ""); }
public bool SelecionarCurso(string arg) { bool _result = false; try { IWebElement Lista = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@id='listaCursosIES_chosen']//a")); util.WaitForElementVisible(Lista, 10); if (Lista.Displayed) { Lista.Click(); Thread.Sleep(500); _result = SelectCurso(arg); } else { } } catch { } return(_result); }
public bool InformarRendaInferiorPrimeiroFiador() { bool _result = false; try { util.WaitForElementVisible(InputRenda, 30); if (InputRenda.Displayed) { InputRenda.Clear(); var msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formCadastroFiador']//div[@class='row'][3]//div[2]//div[1]//div[1] //div[1]//div[1]//div[2]")).Text; var text = msg.Split(' '); var valor = text[8].Replace("R$", ""); valor = valor.Replace(".", ""); valor = valor.Replace(",", ""); //Valor mínimo dívidido por dois var vlr = float.Parse(valor) / 2; valor = vlr.ToString(); InputRenda.SendKeys(valor); _result = true; Thread.Sleep(500); } } catch { } return(_result); }
public void DocsRendaFamiliar() { //string path = ""; try { util.WaitForElementVisible(BtnRendaFamiliar, 15); if (BtnRendaFamiliar.Displayed) { //path = @"C:\Users\leonardo.barcellos\Desktop\Imagens\teste.jpg"; util.ScrollElementoPage(BtnRendaFamiliar); Thread.Sleep(1500); BtnRendaFamiliar.Click(); Thread.Sleep(1300); IWebElement enviar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='modal-dialog']//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//a[1]")); util.ScrollElementoPage(enviar); enviar.Click(); Thread.Sleep(1300); //SendKeys.SendWait(path); //SendKeys.SendWait(@"{Enter}"); Thread.Sleep(1300); IWebElement Confirm = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='modal-dialog']//div/./div[3]//button[1]")); Thread.Sleep(1300); Confirm.Click(); } } catch { } }
//Pegar conteúdo de uma variável Local public static String getItemFromLocalStorage(String key) { IJavaScriptExecutor js = ClassDriver.GetInstance().Driver as IJavaScriptExecutor; return((String)js.ExecuteScript(String.Format( "return window.localStorage.getItem('tokenPES');", key))); }
public bool InformarMetadeRendaSegundoFiador() { bool _result = false; var msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("/html/body/div[2]/div/div/div[2]/div/div/ng-view/section/form/div[6]/div[3]/div[2]/div/renda-minima-fiador/div/div/div[1]/div[2]")).Text; var text = msg.Split(' '); var valor = text[12].Replace("R$", ""); valor = valor.Replace(".", ""); valor = valor.Replace(",", ""); //Valor mínimo dívidido por dois var vlr = float.Parse(valor) / 2; //vlr = vlr - 1; try { util.WaitForElementVisible(InputRenda, 30); if (InputRenda2.Displayed) { InputRenda2.Click(); InputRenda2.Clear(); InputRenda2.SendKeys(vlr.ToString()); _result = true; Thread.Sleep(500); } } catch { } return(_result); }
public bool ValidarConclusao() { bool _result = false; try { Thread.Sleep(2000); IWebElement validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='modal-body text-center']//h1//strong[text()='UHU, cadastro concluído!']")); IWebElement Enviar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formPesquisa']//div[@class='modal-footer']//input[1]")); WebDriverWait wait = new WebDriverWait(ClassDriver.GetInstance().Driver, TimeSpan.FromSeconds(45)); IWebElement emoji = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formPesquisa']//div[1]//div[1]//label[3]")); if (emoji.Displayed) { _result = true; emoji.Click(); Thread.Sleep(1000); Enviar.Click(); } } catch { } return(_result); }
public void ScreenshotPrepare() { screenshots = @"C:\Users\leonardo.barcellos\Desktop\Screenshots\"; CultureInfo cult = new CultureInfo("pt-BR"); string dta = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss", cult); Screenshot(ClassDriver.GetInstance().Driver, screenshots + "ComeceAgora_" + Cont++ + ".png"); }
public void ClickJS_Default(IWebElement element) { try { // this.HigthLine(element, true); IJavaScriptExecutor executor = (IJavaScriptExecutor)ClassDriver.GetInstance().Driver; executor.ExecuteScript("arguments[0].click();", element); } catch (Exception) { } }
public void ClickJS(IWebElement element) { try { IJavaScriptExecutor js = ClassDriver.GetInstance().Driver as IJavaScriptExecutor; js.ExecuteScript("arguments[0].click()", element); } catch (Exception) { } }
public void SendKeyJS(IWebElement element, string value) { try { IJavaScriptExecutor js = ClassDriver.GetInstance().Driver as IJavaScriptExecutor; js.ExecuteScript("arguments[0].setAttribute('value', '" + value + "')", element); } catch (Exception) { } }
public bool AccessPage(string url) { bool _result = false; try { ClassDriver.GetInstance().Driver.Navigate().GoToUrl(url); _result = true; } catch (Exception) { } return(_result); }
public void ScrollElementoPage(IWebElement element) { try { Point point = new Point(); if (element != null) { point = element.Location; IJavaScriptExecutor js = ClassDriver.GetInstance().Driver as IJavaScriptExecutor; js.ExecuteScript("arguments[0].scrollIntoView(true);", element); } } catch (Exception) { } }
public bool ValidarReprovacaoComSucesso() { bool _result = true; try { Thread.Sleep(4000); IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//html/body/div[1]/div/div/div[1]/h2")); if (Validar.Displayed) { _result = false; } } catch { } return(_result); }
public bool ValidarTelaAprovar() { bool _result = false; try { WebDriverWait wait = new WebDriverWait(ClassDriver.GetInstance().Driver, TimeSpan.FromSeconds(40)); IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='modal-content'][1]//div//h2")); Thread.Sleep(5000); if (Validar.Displayed) { _result = true; } } catch { } return(_result); }
public bool ConsultarRendaMinima() { bool _result = false; try { string minimo = db.ConsultaRendaMinima(); if (minimo != null) { var msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formCadastroFiador']//div[@class='row'][3]//div[2]//div[1]//div[1] //div[1]//div[1]//div[2]")).Text; var text = msg.Split(' '); var valor = text[8].Replace("R$", ""); if (valor == minimo + ".") { _result = true; Thread.Sleep(500); } else { _result = false; } } else { IWebElement msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formCadastroFiador']//div[@class='row'][3]//div[2]//div[1]//div[1] //div[1]//div[1]//div[2]")); if (msg.Displayed) { _result = false; } else { _result = true; } } } catch { } return(_result); }
public bool ValidarLogin() { bool _result = false; Thread.Sleep(3000); try { IWebElement BemVindo = ClassDriver.GetInstance().Driver.FindElement(By.XPath("/html/body/div[2]/div/div/div[1]/ng-include/div/div/h3")); util.WaitForElementVisible(BemVindo, 45); if (BemVindo.Displayed) { _result = true; Thread.Sleep(3000); } } catch { } return(_result); }
public bool ValidarLoginCamunda() { bool _result = false; Thread.Sleep(2000); IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("/html/body/div[1]/nav/ul/li[2]/a")); try { if (Validar.Displayed) { _result = true; } } catch { } return(_result); }
public bool ValidarTelaDePesquisa(string arg) { bool _result = false; Thread.Sleep(1500); IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("/html/body/div[2]/h1[contains(text(), '" + arg + "')]")); try { if (Validar.Displayed) { _result = true; } } catch { } return(_result); }
public bool VerificarMsgLoginInvalido() { bool _result = false; Thread.Sleep(1000); IWebElement MsgErro = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//*[@id='frmLogin']/fieldset/div/span")); util.WaitForElementVisible(MsgErro, 45); try { if (MsgErro.Displayed) { _result = true; } } catch { } return(_result); }
public bool ValidAccessPage() { bool _result = false; try { IWebElement LogoHome = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div//a[@class='logo']")); util.WaitForElementVisible(LogoHome, 25); if (LogoHome.Displayed) { _result = true; } else { } } catch (Exception) { } return(_result); }
public bool ValidarMsgRendaInvalidaDoisFiadores() { bool _result = false; util.WaitForElementVisible(MsgRendaInvalida, 15); IWebElement msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("/html/body/div[2]/div/div/div[2]/div/div/ng-view/section/form/div[6]/div[3]/div[2]/div/renda-minima-fiador/div/div/div[1]/div[2]")); try { if (MsgRendaInvalida.Text.Contains("A renda informada não é suficiente.") && msg.Text.Contains("A renda informada não é suficiente.")) { _result = true; Thread.Sleep(500); } } catch { } return(_result); }
public bool ValidarLogin() { bool _result = false; try { Thread.Sleep(4500); IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//div[@class='container-fluid']//div//img")); util.WaitForElementVisible(Validar, 45); if (Validar.Displayed) { _result = true; } else { } } catch { } return(_result); }
public bool ValidarAcessoIes() { bool _result = false; try { Thread.Sleep(10000); IWebElement formLogin = ClassDriver.GetInstance().Driver.FindElement(By.Id("formLogin")); util.WaitForElementVisible(formLogin, 45); if (formLogin.Displayed) { _result = true; } else { } } catch { } return(_result); }
public bool VerificarMsgCpfInvalido() { bool _result = false; Thread.Sleep(1000); IWebElement MsgErro = ClassDriver.GetInstance().Driver.FindElement(By.Id("txtCpfLogin-error")); util.WaitForElementVisible(MsgErro, 45); try { if (MsgErro.Displayed) { _result = true; } } catch { } return(_result); }
public bool ValidarDirecionamentoDocumentos() { bool _result = false; try { IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//h2[text()='Documentos']")); util.WaitForElementVisible(Validar, 15); if (Validar.Displayed) { util.ScrollElementoPage(Validar); _result = true; } else { } } catch { } return(_result); }
public bool ValidarMensagem(string arg) { bool _result = false; try { Thread.Sleep(1800); var msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formCadastroFiador']//div[@class='row'][3]//div[2]//div[1]//div[1] //div[1]//div[1]//div[2 and text()=' Seu fiador precisa comprovar renda bruta mínima de R$3.808,14. ']")).Text; var text = msg.Split(' '); var valor = text[8].Replace("R$", ""); if (valor == arg) { _result = true; Thread.Sleep(500); } } catch { } return(_result); }
public bool ValidarMensagemFiadorCadastrado(string arg) { bool _result = false; try { Thread.Sleep(2000); var msg = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//form[@name='formCadastroFiador']//div[@class='row'][3]//div[2]//div[1]//div[1] //div[1]//div[1]//div[2]")).Text; var text = msg.Split(' '); var valor = text[8].Replace("R$", ""); if (valor == arg) { _result = true; Thread.Sleep(500); } } catch { } return(_result); }
public bool ValidarDirecionamentoEtapa4() { bool _result = false; try { IWebElement Validar = ClassDriver.GetInstance().Driver.FindElement(By.XPath("//h2[text()='Dados Pessoais']")); util.WaitForElementVisible(Validar, 45); if (Validar.Displayed) { _result = true; } else { } } catch { } return(_result); }