public string InserLog(log_navegacao log) { Sql.SaveLog(log); List <log_navegacao> Listid = Sql.SelectId(log).ToList(); return(Listid.FirstOrDefault().id); }
public void Sms(ChromeDriver _chrome, Pessoa pessoa, log_navegacao log) { try { if (log.idportal == Convert.ToInt32(Portal.SkyAdesao)) { AjustSendKeys.SendKeysById("name", pessoa.Name, _chrome); AjustSendKeys.SendKeysById("phone", pessoa.Phone, _chrome); AjustClick.ClickById("next-step", _chrome); pagebase.GaveGood(_chrome, pessoa, log); _chrome.Navigate().Back(); _chrome.Navigate().Back(); } else { AjustClick.ClickById("contact-sms", _chrome); AjustSendKeys.SendKeysById("sms_name", pessoa.Name.ToString(), _chrome); AjustSendKeys.SendKeysById("sms_phone", pessoa.Phone.ToString(), _chrome); AjustClick.ClickById("contact-sms-send", _chrome); AjustClick.ClickByXPath("//*[@id=\"confirmation\"]/div/div/div/input", _chrome); pagebase.GaveGood(_chrome, pessoa, log); } } catch (Exception) { pagebase.Error(_chrome, pessoa, log); } }
public void Chat(ChromeDriver _chrome, log_navegacao log) { try { if (log.idportal == Convert.ToInt32(Portal.SkyAdesao) || log.idportal == Convert.ToInt32(Portal.Net)) { } else { pessoa.CPF = log.cpf; AjustClick.ClickById("contact-chat", _chrome); } if (pagebase.ExpectedUrl(_chrome, "callflex.com.b")) { pagebase.GaveGood(_chrome, pessoa, log); _chrome.Navigate().Back(); } else { pagebase.Fail(); } } catch (Exception) { pagebase.Error(_chrome, pessoa, log); } }
/// <summary> /// Assinar Todos os Combos Pelo Chat /// </summary> /// <param name="_chrome"></param> public void Combos(ChromeDriver _chrome, log_navegacao log) { ValidateChat(_chrome, "//*[@id=\"assine_chat_combo_1\"]/button", log); ValidateChat(_chrome, "//*[@id=\"assine_chat_combo_2\"]/button", log); ValidateChat(_chrome, "//*[@id=\"assine_chat_combo_3\"]/button", log); ValidateChat(_chrome, "//*[@id=\"assine_chat_combo_4\"]/button", log); _chrome.Navigate().Back(); }
public void GaveGood(ChromeDriver _chrome, Pessoa pessoa, log_navegacao log) { log.cpf = pessoa.CPF; log.idstatus = 1; log.data_fim = InserTimeFim(); log.pagina = _chrome.Url.ToString(); services.InsertLog(log); }
public void Phone(ChromeDriver _chrome, log_navegacao log) { AjustSendKeys.SendKeysById("nome", Name, _chrome); AjustSendKeys.SendKeysById("phone", pessoa.Phone, _chrome); pagebase.GaveGood(_chrome, pessoa, log); AjustClick.ClickByXPath("//*[@id=\"form-contato\"]/div[3]/button", _chrome); AjustClick.ClickByXPath("/html/body/main/section/div/div[2]/button", _chrome); }
public void SaveEx(ChromeDriver _chrome, log_navegacao log) { var url = _chrome.Url.ToString(); url = Regex.Replace(url, ".+combonetvendas.com.br/", ""); var ex = ("Tela :" + url + "- OK"); log.Exception = ex; }
public void Error404(ChromeDriver _chrome, Pessoa pessoa, log_navegacao log) { log.cpf = pessoa.CPF; log.idstatus = 3; log.data_fim = InserTimeFim(); log.pagina = _chrome.Url.ToString(); var s = _chrome.GetScreenshot(); string Id = services.InserLog(log).ToString(); s.SaveAsFile(_Erro + "\\" + Id + "_SiteForadoar.Jpeg", OpenQA.Selenium.ScreenshotImageFormat.Jpeg); }
public void ValidatePayment(ChromeDriver _chrome, log_navegacao log) { try { if (pagebase.ExpectedUrl(_chrome, "pay-info/methods")) { AjustClick.ClickById("btn_pagamento_a_vista", _chrome); if (pagebase.ExpectedUrl(_chrome, "payment-cash")) { PaymentCash(_chrome); } else { pagebase.Fail(); } AjustClick.ClickById("btn_pagamento_parcelado", _chrome); if (_chrome.Url.Contains("payment-parcel")) { if (log.idportal != 8) { AjustClick.ClickByXPath("/html/body/main/section/div/div[2]/table/tbody/tr[1]/td/div/input", _chrome); //WebDriverWait wait = new WebDriverWait(_chrome, TimeSpan.FromSeconds(30)); //wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.XPath(""))); //_chrome.FindElementByCssSelector("#numero-parcelas-send > option:nth-child(2)").Click(); //AjustClick.ClickByXPath("//*[@id=\"register-bank-slip\"]/p[1]/label", _chrome); //AjustClick.ClickByXPath("//*[@id=\"confirmar-parcelamento\"]", _chrome); //AjustClick.ClickByXPath("/html/body/main/section/div/div[3]/button[3]", _chrome); pagebase.GaveGood(_chrome, pessoa, log); AjustClick.ClickByXPath("/html/body/main/section/div/div[3]/button[3]", _chrome); } else { AjustClick.ClickByXPath("/html/body/main/section/div/div[2]/table/tbody/tr[1]/td/div/input", _chrome); pagebase.GaveGood(_chrome, pessoa, log); AjustClick.ClickByXPath("/html/body/main/section/div/div[3]/button[3]", _chrome); } } else { pagebase.Fail(); } } else { pagebase.Fail(); } } catch (Exception e) { pagebase.Error(_chrome, pessoa, log); } }
public void reportpayment(ChromeDriver _chrome, log_navegacao log) { try { _chrome.FindElementByCssSelector("body > main > section > div > div:nth-child(4) > button:nth-child(2)").Click(); _reportpayment(_chrome, log); } catch (Exception) { AjustClick.ClickByXPath("/html/body/main/section/div/div[3]/button[2]", _chrome); _reportpayment(_chrome, log); } }
public void WhatsApp(ChromeDriver _chrome, log_navegacao log) { try { if (_chrome.Url.Contains("/contact") || _chrome.Url.Contains("whatsapp")) { pessoa.CPF = log.cpf; if (pagebase.ExpectedUrl(_chrome, "send?phone=")) { Thread.Sleep(1000); _chrome.Url = Regex.Replace(_chrome.Url, "=.+", "=5541900000000"); Thread.Sleep(1000); if (pagebase.ExpectedUrl(_chrome, "send?phone")) { } //deu boa else { pagebase.Fail(); } AjustClick.ClickById("action-button-container", _chrome); Thread.Sleep(100); if (pagebase.ExpectedUrl(_chrome, "web.whatsapp.com/")) { } //Deu boa else { pagebase.Fail(); } } else { pagebase.Fail(); } pagebase.GaveGood(_chrome, pessoa, log); for (int i = 0; i < 20; i++) { _chrome.Navigate().Back(); if (_chrome.Url.Contains("/contact") || _chrome.Url.Contains("fiquenaclaro")) { break; } } } } catch (Exception e) { pagebase.Error(_chrome, pessoa, log); return; } }
public void _reportpayment(ChromeDriver _chrome, log_navegacao log) { Thread.Sleep(1000); if (_chrome.Url.Contains("pay-info/schedule")) { AjustClick.ClickByXPath("//*[@id=\"form-alega-pagamento\"]/div[1]/div/div[1]/img[2]", _chrome); AjustClick.ClickByXPath("//*[@id=\"alega-pagamento-send\"]", _chrome); pagebase.GaveGood(_chrome, pessoa, log); AjustClick.ClickById("btn-fechar", _chrome); AjustClick.ClickByXPath("//*[@id=\"form-alega-pagamento\"]/div[2]/button[2]", _chrome); } else { pagebase.Fail(); } }
public void NegotiateDebt(ChromeDriver _chrome, log_navegacao log) { try { _chrome.FindElementByCssSelector("body > main > section > div > div:nth-child(4) > button:nth-child(1)").Click(); ValidatePayment(_chrome, log); pagebase.GaveGood(_chrome, pessoa, log); AjustClick.ClickByXPath("//*[@id=\"btn_voltar\"]", _chrome); } catch (Exception e) { _chrome.FindElementByCssSelector("body > main > section > div > div:nth-child(3) > button:nth-child(1)").Click(); ValidatePayment(_chrome, log); pagebase.GaveGood(_chrome, pessoa, log);; AjustClick.ClickByXPath("//*[@id=\"btn_voltar\"]", _chrome); } }
public void Facebook(ChromeDriver _chrome, log_navegacao log) { try { pessoa.CPF = log.cpf; AjustClick.ClickById("contact-facebook", _chrome); if (pagebase.ExpectedUrl(_chrome, "facebook")) { pagebase.GaveGood(_chrome, pessoa, log); _chrome.Navigate().Back(); } } catch (Exception) { pagebase.Error(_chrome, pessoa, log); } }
public void ValidateChat(ChromeDriver _chrome, string element, log_navegacao log) { Ajust(_chrome, element); SaveEx(_chrome, log); for (int i = 0; i < 30; i++) { Thread.Sleep(2000); if (_chrome.Url.Contains("srvcloo2.callflex")) { _social.Chat(_chrome, log); break; } else { Ajust(_chrome, element); } } }
public void Telegram(ChromeDriver _chrome, log_navegacao log) { if (_chrome.Url.Contains("telegram")) { pagebase.GaveGood(_chrome, pessoa, log); for (int i = 0; i < 20; i++) { _chrome.Navigate().Back(); if (_chrome.Url.Contains("/contact")) { break; } } } else { pagebase.Fail(); } }
public bool ValidateNotFound(ChromeDriver _chrome, log_navegacao log) { if (!ValidatePage(_chrome, tipo.Id, "header", "Server Error", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.XPath, "/html/body/h2", "Not Found", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.XPath, "/html/body/h2", "Service Unavailable", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.Id, "main-message", "Não é possível acessar esse site", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.XPath, "//*[@id=\"L_10060_2\"]", "Network Access Message:", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.XPath, "//*[@id=\"frame-line-0\"]/div[1]/span[1]/div", "Twig_Error_Runtime", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.Id, "titulo", "Página não encontrada", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.XPath, "//*[@id=\"main-message\"]/h1", "Não foi possível encontrar a página deste", log, pessoa)) { return(false); } if (!ValidatePage(_chrome, tipo.Id, "header", "Erro do Servidor", log, pessoa)) { return(false); } return(true); }
public void Error(ChromeDriver _chrome, Pessoa pessoa, log_navegacao log) { try { log.cpf = pessoa.CPF; log.idstatus = 2; log.data_fim = InserTimeFim(); log.pagina = _chrome.Url.ToString(); var s = _chrome.GetScreenshot(); string Id = services.InserLog(log).ToString(); s.SaveAsFile(_Erro + "\\" + Id + "_Erro.Jpeg", OpenQA.Selenium.ScreenshotImageFormat.Jpeg); } catch (Exception e) { if (log.idportal == Convert.ToInt32(Portal.skyprepago)) { log.pagina = "ganhemaiscomoprepago.com.br"; services.InsertLog(log); } } }
public void CustomerService(ChromeDriver _chrome, log_navegacao log) { try { if (log.idportal == 8) { AjustClick.ClickByXPath("/html/body/main/section/div/div[3]/button[3]", _chrome); _Service(_chrome, log); } else { AjustClick.ClickByXPath("/html/body/main/section/div/div[3]/button[3]", _chrome); _Service(_chrome, log); } } catch (Exception) { if (log.idportal == 8) { AjustClick.ClickByXPath("/html/body/main/section/div/div[4]/button[3]", _chrome); _Service(_chrome, log); } } }
public void InsertLog(log_navegacao log) { Sql.SaveLog(log); }
public bool ValidatePage(ChromeDriver _chrome, tipo tipo, string titulo, string text, log_navegacao log, Pessoa pessoa) { try { _chrome.Navigate().GoToUrl(log.pagina); log.cpf = pessoa.CPF; var pagenotfound = (dynamic)null; switch (tipo) { case tipo.ClassName: pagenotfound = AjustElement.AjustExceptionsByClassName(titulo, _chrome); break; case tipo.Id: pagenotfound = AjustElement.AjustExceptionsById(titulo, _chrome); break; case tipo.Name: pagenotfound = AjustElement.AjustExceptionsByName(titulo, _chrome); break; case tipo.TagName: pagenotfound = AjustElement.AjustExceptionsByTagName(titulo, _chrome); break; case tipo.XPath: pagenotfound = AjustElement.AjustExceptionsByXPath(titulo, _chrome); break; case tipo.CssSelector: pagenotfound = _chrome.FindElementByCssSelector(titulo); break; case tipo.LinkText: pagenotfound = _chrome.FindElementByLinkText(titulo); break; } if (pagenotfound.Text.Contains(text)) { log.Exception = "Página Fora do Ar:" + _chrome.Url.ToString();; Error404(_chrome, pessoa, log); return(false); } return(false); } catch (Exception e) { return(true); } }
public void _Service(ChromeDriver _chrome, log_navegacao log) { if (pagebase.ExpectedUrl(_chrome, "contact")) { AjustClick.ClickById("btn_contato_chat", _chrome); if (pagebase.ExpectedUrl(_chrome, "virtual/chat/")) { pagebase.GaveGood(_chrome, pessoa, log); _chrome.Navigate().Back(); } else { pagebase.Fail(); } AjustClick.ClickById("btn_contato_whatsapp", _chrome); Thread.Sleep(1000); socialNetworks.WhatsApp(_chrome, log); if (log.idportal == 8) { IList <IWebElement> button = _chrome.FindElementsByCssSelector("body > main > section > div > div:nth-child(2) > div"); foreach (var item in button) { if (item.Text.Equals("SMS")) { item.Click(); Thread.Sleep(2000); if (_chrome.Url.Contains("sms")) { Phone(_chrome, log); break; } } } IList <IWebElement> button2 = _chrome.FindElementsByCssSelector("body > main > section > div > div:nth-child(2) > div"); foreach (var item in button2) { if (item.Text.Equals("Telegram")) { item.Click(); Thread.Sleep(2000); Telegram(_chrome, log); break; } } } IList <IWebElement> button3 = _chrome.FindElementsByCssSelector("body > main > section > div > div:nth-child(2) > div"); foreach (var item in button3) { if (item.Text.Equals("Facebook")) { item.Click(); Thread.Sleep(2000); if (_chrome.Url.Contains("facebook")) { pagebase.GaveGood(_chrome, pessoa, log); _chrome.Navigate().Back(); break; } } } AjustClick.ClickById("btn_contato_ligacao", _chrome); Thread.Sleep(1000); Phone(_chrome, log); AjustClick.ClickById("btn_contato_email", _chrome); if (_chrome.Url.Contains("email")) { AjustSendKeys.SendKeysById("nome", Name, _chrome); AjustSendKeys.SendKeysById("email", pessoa.Email, _chrome); pagebase.GaveGood(_chrome, pessoa, log); AjustClick.ClickByXPath("//*[@id=\"form-contato\"]/div[3]/button", _chrome); AjustClick.ClickByXPath("/html/body/main/section/div/div[2]/button", _chrome); } else { pagebase.Fail(); } } else { pagebase.Fail(); } AjustClick.ClickByXPath("/html/body/main/section/div/div[4]/button[1]", _chrome); Thread.Sleep(3000); }
public string GetCPF(log_navegacao log) { ListCpf = _Sql.GetCPF(log).ToList(); return(Rand(ListCpf, 1, ListCpf.Count)); }
public IEnumerable <Pessoa> SaveLog(log_navegacao log) { string query = "INSERT INTO log_navegacao (idportal, pagina, idstatus, data_ini, data_fim, cpf, Exception) VALUES (" + log.idportal + ",'" + log.pagina + "'," + log.idstatus + ",'" + log.data_ini + "','" + log.data_fim + "','" + log.cpf + "','" + log.Exception + "')"; return(_repository.GetDapperResult <Pessoa>(query, new Constants().X9_cns)); }
public IEnumerable <log_navegacao> SelectId(log_navegacao log) { string query = "SELECT ID FROM log_navegacao WHERE IDPORTAL = " + log.idportal + " AND PAGINA = '" + log.pagina + "' AND IDSTATUS = " + log.idstatus + " AND DATA_INI = '" + log.data_ini + "' AND DATA_FIM = '" + log.data_fim + "'"; return(_repository.GetDapperResult <log_navegacao>(query, new Constants().X9_cns)); }
public IEnumerable <Pessoa> GetCPF(log_navegacao log) { string query = "select cpf from pessoas where idportal = " + log.idportal + " and isdeleted = 0"; return(_repository.GetDapperResult <Pessoa>(query, new Constants().X9_cns)); }