Example #1
0
        public void PagamentCash()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Pagamento Cash
            //Botao Menu
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();

            //Seleciona o Cash
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/nav/div[2]/div/input")).SendKeys("CASH");
            driver.FindElement(By.XPath("/html/body/div[5]/nav/div[3]/ul/li/a/span")).Click();

            //Seleciona Lançamentos
            driver.FindElement(By.LinkText("Lançamentos")).Click();

            //Incluir
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div/vs-relacao3/div/div/div/div/div/div/div[1]/button")).Click();

            //Empresa
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormcashFlowLancamentosFinanceirosundefined_edt_emp_codigo")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[1]/form/div[1]/div/div[2]/div[1]/div/div/vs-editavel3/div/ul/li[1]/a")).Click();

            //Vencimento
            driver.FindElement(By.Name("frmAutoFormcashFlowLancamentosFinanceirosundefined_edt_lb_data")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();

            //Conta
            driver.FindElement(By.Name("frmAutoFormcashFlowLancamentosFinanceirosundefined_edt_cta_codigo")).SendKeys("conta bb");
            driver.FindElement(By.LinkText("CONTA BB")).Click();

            //Salvar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/vs-botoes3/div/div/div[2]/button[1]")).Click();

            //Edita
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/vs-botoes3/div/div/div[1]/button[1]")).Click();

            //Clicar em incluir detalhes
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[1]/button")).Click();

            //Clicar em Valor
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td/div[1]/vs-editavel3/div/input")).SendKeys("125,00");

            //Clicar em categoria
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td/div[3]/vs-editavel3/div/input")).SendKeys("AGUA");
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td/div[3]/vs-editavel3/div/ul/li/a")).Click();

            //Clicar em Pessoa
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td/div[4]/vs-editavel3/div/input")).SendKeys("FRANCISCO");
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td/div[4]/vs-editavel3/div/ul/li/a")).Click();

            //Salvar
            driver.FindElement(By.CssSelector("body > div:nth-child(5) > div.container-fluid > div.row > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral.col-menu-vert-11 > div:nth-child(3) > vs-botoes3 > div > div > div:nth-child(2) > button.btn.btn-flat.btn-default.botoes-bottom-verde")).Click();

            #endregion
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void CadastraPropostaPF()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            System.Threading.Thread.Sleep(8000);
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastro de Proposta PF
            //Realizar a busca
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div/input")).SendKeys("fausto silva");

            //Clicar no busca
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div:nth-child(1) > vs-portal-consultas-directive > div > div > div > div:nth-child(3) > div > span > button")).Click();

            //Clicar no cliente
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            IWebElement cliente = driver.FindElement(By.PartialLinkText("FAUSTO SILVA"));
            cliente.Click();

            //Clicar em seguros
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[3]/div/vs-menu-responsivo/div/div[2]/div/div/ul/li[2]/a")).Click();

            //Clicar em incluir
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/vs-relacao3/div/div/div/div/div/div/div[1]/button")).Click();

            //seleciona seguradora
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).SendKeys("porto");
            driver.FindElement(By.CssSelector("strong")).Click();

            //Seleciona o Produto
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).SendKeys("automoveis");
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.LinkText("AUTOMOVEIS")).Click();

            //Seleciona a Origem
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).SendKeys("geral");
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.LinkText("GERAL")).Click();

            //Seleciona o ponto de vendas
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Clear(); //Deixa o campo vazio
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).SendKeys("matriz");
            System.Threading.Thread.Sleep(2000);                                                  //Aguardando a pagina carregar
            driver.FindElement(By.LinkText("MATRIZ")).Click();

            //Gravar
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            #endregion
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void CadastraDocMaisVendedor()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(5000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento1 = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder1  = new Actions(driver);
                builder1.MoveToElement(elemento1).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builderA = new Actions(driver);
                builderA.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastrar Documento com mais de um vendedor
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            //Busca o cliente
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div/input")).SendKeys("fausto silva");
            //Clica na busca
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div:nth-child(1) > vs-portal-consultas-directive > div > div > div > div:nth-child(3) > div > span > button")).Click();

            //Selecionar o cliente buscado
            System.Threading.Thread.Sleep(6000); //Aguardando a pagina carregar
                                                 // driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div > div.col-sm-12.col-lg-9 > div > div > div:nth-child(2) > div.col-lg-12.col-md-12.col-sm-12 > div > div.card-body.card-padding.ng-scope > div > div:nth-child(1) > div > h3 > a")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div/div[2]/div/div/div[2]/div[1]/div/div[3]/div/div[1]/div/h3/a")).Click();
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            //Clicar em Seguros
            driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[3]/div/vs-menu-responsivo/div/div[2]/div/div/ul/li[2]/a")).Click();

            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            //Clicar em Incluir
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/vs-relacao3/div/div/div/div/div/div/div[1]/button")).Click();

            //Seleciona a cia
            System.Threading.Thread.Sleep(10000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).SendKeys("porto");
            driver.FindElement(By.CssSelector("strong")).Click();


            //Seleciona o Produto
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).SendKeys("AERO");
            driver.FindElement(By.CssSelector("strong")).Click();

            //Seleciona Origem
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).SendKeys("geral");
            driver.FindElement(By.CssSelector("strong")).Click();

            //Seleciona Ponto de Venda
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Clear();//Limpar o Campo
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).SendKeys("matriz");
            driver.FindElement(By.CssSelector("strong")).Click();

            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).Click();
            //Salvar
            driver.FindElement(By.CssSelector(".container-fluid > .row")).Click();
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();


            //MouseOver pra selecionar o Botão valores
            System.Threading.Thread.Sleep(15000);
            //driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Click();
            //driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[4]/div[2]/div/i")).Click();
            //driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[4]/div[2]/a")).Click();

            driver.SwitchTo().Window(driver.WindowHandles[0]);
            var     element = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[4]/div[2]/div/i"));
            Actions builder = new Actions(driver);
            builder.MoveToElement(element).Release().Perform();
            try
            {
                System.Threading.Thread.Sleep(500);
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[4]/div[2]/div/i")).Click();
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[4]/div[2]/a")).Click();
            }
            catch
            {
            }



            //Valores
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[4]/div[2]/a")).Click();
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/div[3]/div[2]/div/div/vs-botoes3/div/div/div[1]/button[1]")).Click();

            //Parcelas
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_qtd_parcelas")).SendKeys("5,0");

            //Comissão Total
            driver.ExecuteJavaScript("window.scroll(0,1000)"); //Scroll na página
            System.Threading.Thread.Sleep(5000);               //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_perc_comissao_total")).SendKeys(Keys.Control + "A");
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_perc_comissao_total")).SendKeys(Keys.Delete);
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_perc_comissao_total")).SendKeys("20,00");
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_perc_comissao")).SendKeys(Keys.Control + "A");
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_perc_comissao")).SendKeys(Keys.Delete);
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_perc_comissao")).SendKeys("20,00");

            //Premio
            //driver.ExecuteJavaScript("window.scroll(0,1000)");
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_premio_liquido")).SendKeys(Keys.Control + "A");
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_premio_liquido")).SendKeys(Keys.Delete);
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_premio_liquido")).SendKeys("2.000");
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_premio_total")).SendKeys(Keys.Control + "A");
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_premio_total")).SendKeys(Keys.Delete);
            driver.FindElement(By.Name("frmAutoFormdocumentosValoresundefined_edt_doc_premio_total")).SendKeys("2.147,60");


            //Salvar

            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            System.Threading.Thread.Sleep(10000);
            //Repasses
            var     element2 = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/div/i"));
            Actions builder2 = new Actions(driver);
            builder2.MoveToElement(element2).Perform();

            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/a")).Click();



            System.Threading.Thread.Sleep(3000);
            // driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[1]/button[2]")).Click();

            System.Threading.Thread.Sleep(5000);
            //driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/a")).Click();
            System.Threading.Thread.Sleep(5000);
            driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]")).Click();
            System.Threading.Thread.Sleep(5000);
            //driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/a/span")).Click();
            // driver.FindElement(By.CssSelector(".confirm")).Click();

            //Incluir
            driver.FindElement(By.CssSelector(".btn-raised")).Click();
            driver.FindElement(By.Id("comboundefined")).Click();
            driver.FindElement(By.Id("comboundefined")).SendKeys("francisco teste");
            driver.FindElement(By.CssSelector("strong")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosRepasseundefined_edt_rep_percentual")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosRepasseundefined_edt_rep_percentual")).SendKeys("50");
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            {
                var     element3 = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/div"));
                Actions builder3 = new Actions(driver);
                builder3.MoveToElement(element3).Perform();
            }
            {
                var     element4 = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/div"));
                Actions builder4 = new Actions(driver);
                builder4.MoveToElement(element4).Perform();
            }
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/a")).Click();
            //Cadastrando segundo vendedor
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/div[2]/vs-relacao3/div/div/div/div/div/div/div[1]/button")).Click();
            driver.FindElement(By.Id("comboundefined")).SendKeys("f");
            driver.FindElement(By.Id("comboundefined")).SendKeys("r");
            driver.FindElement(By.Id("comboundefined")).SendKeys("a");
            driver.FindElement(By.Id("comboundefined")).SendKeys("n");
            driver.FindElement(By.Id("comboundefined")).SendKeys("c");
            driver.FindElement(By.LinkText("FRANCISCO")).Click();
            driver.FindElement(By.CssSelector("div:nth-child(1) > .col-md-6")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosRepasseundefined_edt_rep_percentual")).SendKeys("50");
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            {
                var     element5 = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[6]/div[2]/div"));
                Actions builder5 = new Actions(driver);
                builder5.MoveToElement(element5).Perform();
            }
            #endregion
            driver.FindElement(By.XPath("//*[@id=\"menuTopo\"]/div[1]/a")).Click();
            System.Threading.Thread.Sleep(2000);
            //Fecha o navegador
            MetodosNavega.SairPlus(driver);
        }
Example #4
0
        public void AutomacaoDeComissao()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                //builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            System.Threading.Thread.Sleep(6000);

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Automação de comissão
            //Seleciona Automação de comissão
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".icon-receipt:nth-child(2)")).Click();

            //Clica na cia "Bradesco"
            //            driver.ExecuteJavaScript("window.scroll(0,1000)");//Scroll na página
            System.Threading.Thread.Sleep(10000);//Aguardando a pagina carregar
            try
            {
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[3]/div[1]/div[2]/div/div[19]")).Click();
            }
            catch
            {
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[3]/div[1]/div[2]/div/div[19]/div/div[2]")).Click();
            }
            //Informa corretora
            driver.FindElement(By.Id("comboundefined")).Click();
            driver.FindElement(By.Id("comboundefined")).SendKeys("matriz");
            driver.FindElement(By.Id("comboundefined")).SendKeys(Keys.Enter);


            //Desmarcar
            System.Threading.Thread.Sleep(20000);//Aguardando a pagina carregar
            //driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div:nth-child(4) > div > div.clearfix.card-header.bg-card-teal > div > spam:nth-child(2)")).Click();
            //driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[2]/div/div[2]/div[2]/div/div/div[1]/table/tbody/tr/td[1]/vs-editavel3/div/label/input")).Click();
            //Marcar somente um
            driver.ExecuteJavaScript("window.scroll(0,1000)");

            string semArquivos = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[3]/div/div[2]/div/h5")).Text;

            System.Threading.Thread.Sleep(5000);

            try
            {
                string qtdArquivosBaixados = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[4]/div/div[1]/h2")).Text;
                int    qtdArqBaixados      = MetodosNavega.DevolveNumeroDeUmTexto(qtdArquivosBaixados);

                if (qtdArqBaixados >= 1)
                {
                    if (qtdArqBaixados == 1)
                    {
                        driver.FindElement(By.CssSelector(".ng-scope:nth-child(1) > td .check")).Click();
                        driver.FindElement(By.CssSelector(".ng-scope:nth-child(1) > td .check")).Click();
                    }
                    else
                    {
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[4]/div/div[1]/div/spam[2]")).Click();
                        }
                        catch
                        {
                            for (int i = 1; i <= qtdArqBaixados; i++)
                            {
                                driver.FindElement(By.CssSelector(".ng-scope:nth-child(" + i + ") > td .check")).Click();
                            }
                        }

                        driver.FindElement(By.CssSelector(".ng-scope:nth-child(1) > td .check")).Click();
                    }

                    System.Threading.Thread.Sleep(5000);
                    //Continuar
                    driver.FindElement(By.CssSelector(".btn-md")).Click();
                    System.Threading.Thread.Sleep(5000);
                    //Grava
                    System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
                    System.Threading.Thread.Sleep(5000);

                    //ESC para fechar a tela de dados da importação
                    System.Threading.Thread.Sleep(5000);
                    Actions action = new Actions(driver);
                    action.SendKeys(OpenQA.Selenium.Keys.Escape).Perform();
                    System.Threading.Thread.Sleep(5000);
                    driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[5]/div/div/button")).Click();
                    System.Threading.Thread.Sleep(5000);

                    if (driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[2]/div[2]/div/div[1]/h2")).Displayed)
                    {
                        //Definindo a categoria e conta para envio ao cashflow
                        driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[5]/div/div/button[2]")).Click();
                        System.Threading.Thread.Sleep(6000);


                        IWebElement categoria = driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/div[4]/vs-editavel3/div/input"));
                        IWebElement conta     = driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/div[5]/vs-editavel3/div/input"));

                        {
                            Actions actionProvider = new Actions(driver);
                            actionProvider.Click(categoria).Build().Perform();
                            actionProvider.Click(categoria).Build().Perform();
                            actionProvider.SendKeys(categoria, "COMISSÕES RECEBIDAS");
                            actionProvider.Click(categoria).Build().Perform();
                            driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/div[4]/vs-editavel3/div/ul/li/a")).Click();
                        }

                        {
                            Actions actionProvider2 = new Actions(driver);
                            // Perform click-and-hold action on the element
                            actionProvider2.Click(conta).Build().Perform();
                            actionProvider2.Click(conta).Build().Perform();
                            actionProvider2.SendKeys(conta, "CONTA BB").Build().Perform();
                            driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/div[5]/vs-editavel3/div/ul/li/a")).Click();
                        }

                        //Clicando no Gravar informações.
                        driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[3]/div/button[3]")).Click();
                    }
                }
            }
            catch
            {
                IWebElement graverInformacaoes = driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[3]/div/button[3]"));
                Actions     actionsProvider3   = new Actions(driver);
                actionsProvider3.Click(graverInformacaoes).Build().Perform();
            }

            #endregion

            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
                                                 //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #5
0
        public void CadastroDePJ()
        {
            #region Gera CNPJ
            string GerarCNPJ()
            {
                // Gerar 8 números aleatórios de 0 a 9 e 4 números (0001), e depois calcular eles
                // Colocar eles na maskedTextBox

                Random rnd = new Random();
                int    n1  = rnd.Next(0, 10);
                int    n2  = rnd.Next(0, 10);
                int    n3  = rnd.Next(0, 10);
                int    n4  = rnd.Next(0, 10);
                int    n5  = rnd.Next(0, 10);
                int    n6  = rnd.Next(0, 10);
                int    n7  = rnd.Next(0, 10);
                int    n8  = rnd.Next(0, 10);
                int    n9  = 0;
                int    n10 = 0;
                int    n11 = 0;
                int    n12 = 1;

                int Soma1 = n1 * 5 + n2 * 4 + n3 * 3 + n4 * 2 + n5 * 9 + n6 * 8 + n7 * 7 + n8 * 6 + n9 * 5 + n10 * 4 + n11 * 3 + n12 * 2;

                int DV1 = Soma1 % 11;

                if (DV1 < 2)
                {
                    DV1 = 0;
                }
                else
                {
                    DV1 = 11 - DV1;
                }

                int Soma2 = n1 * 6 + n2 * 5 + n3 * 4 + n4 * 3 + n5 * 2 + n6 * 9 + n7 * 8 + n8 * 7 + n9 * 6 + n10 * 5 + n11 * 4 + n12 * 3 + DV1 * 2;

                int DV2 = Soma2 % 11;

                if (DV2 < 2)
                {
                    DV2 = 0;
                }
                else
                {
                    DV2 = 11 - DV2;
                }

                return(n1.ToString() + n2 + n3 + n4 + n5 + n6 + n7 + n8 + n9 + n10 + n11 + n12 + DV1 + DV2);
            }

            #endregion

            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }

            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastrar PJ
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            System.Threading.Thread.Sleep(1000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(3) > ul > li:nth-child(2) > a > span")).Click();
            System.Threading.Thread.Sleep(1000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div > form > div.paddingCard.col-lg-7.col-md-12.col-sm-12.col-xs-12 > div > div.clearfix.card-header.bg-card-teal > button")).Click();
            //Informa Nome
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_nome")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_nome")).SendKeys("MONSTROS SA");
            //Informa Tipo de Pessoa
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_tipo_pessoa")).Click();
            driver.FindElement(By.LinkText("Jurídica")).Click();
            //Informa CNPJ
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_cpf_cnpj")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_cpf_cnpj")).SendKeys(GerarCNPJ());
            //Data de Nascimento
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_data_nascimento")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();
            //Ponto de venda
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_pto_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_pto_codigo")).SendKeys("matriz");
            driver.FindElement(By.LinkText("MATRIZ")).Click();
            //Vendedor
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_vend_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_vend_codigo")).SendKeys("francisco");
            driver.FindElement(By.LinkText("FRANCISCO")).Click();
            //Origem
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cliori_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cliori_codigo")).SendKeys("geral");
            driver.FindElement(By.LinkText("GERAL")).Click();
            //Sroll na tela
            driver.ExecuteJavaScript("window.scroll(0,1000)");
            //Endereço
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_tpender_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_tpender_codigo")).SendKeys("residencial");
            System.Threading.Thread.Sleep(1500);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div/form/div[5]/div/div[2]/div[2]/div[1]/div/vs-editavel3/div/ul/li/a")).Click();
            System.Threading.Thread.Sleep(1500);
//            driver.FindElement(By.Id("campoCep")).Click();
            driver.FindElement(By.Id("campoCep")).SendKeys("84025-350");
            //Quando digita o CEP ele carrega a tela para trazer o endereço
            {
                var     element = driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_ender_numero"));
                Actions builder = new Actions(driver);
                builder.MoveToElement(element).ClickAndHold().Perform();
            }
            {
                var     element = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder = new Actions(driver);
                builder.MoveToElement(element).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_ender_numero")).SendKeys("350");
            //Salvar
            driver.FindElement(By.CssSelector("div:nth-child(2) > .btn > span:nth-child(2)")).Click();
            #endregion
            //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #6
0
        public void LiberarRepasse()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            System.Threading.Thread.Sleep(5000);
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Liberar Repasse
            System.Threading.Thread.Sleep(6000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(3) > .menu > .menu-item:nth-child(9) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".menu-item:nth-child(9) > .expandida > .menu > .menu-item:nth-child(4) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("//*[@id=\"menuEsquerda\"]/div[3]/ul/li[9]/div/ul/li[4]/div/ul/li[1]/a")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[3]/form/div[1]/div/div[2]/div[2]/div/div/vs-editavel3/div/label/span/span")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-flat:nth-child(2)")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("comboundefined")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[3]/form/div[2]/div/div[2]/div[3]/div[2]/div/vs-editavel3/div/input")).SendKeys("francisco");
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[3]/form/div[2]/div/div[2]/div[3]/div[2]/div/vs-editavel3/div/input")).SendKeys(Keys.Enter);
            //driver.FindElement(By.Id("comboundefined")).SendKeys("porto");
            //System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            //driver.FindElement(By.CssSelector("strong")).Click();
            //System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            //driver.FindElement(By.Name("frmAutoFormrepasseComissaoLiberacaoRepassesundefined_edt_ramo_codigo")).Click();
            //System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            //driver.FindElement(By.Name("frmAutoFormrepasseComissaoLiberacaoRepassesundefined_edt_ramo_codigo")).SendKeys("aeronautico");
            //System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            //driver.FindElement(By.LinkText("AERONAUTICO")).Click();
            //System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar

            driver.FindElement(By.CssSelector(".btn-flat:nth-child(2)")).Click();
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            IWebElement btnLibera = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[4]/div/div/div/button[2]"));
            MetodosNavega.NavegaScroll(driver, btnLibera);
            btnLibera.Click();
            #endregion

            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void ProcessarExtrato()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Processar Extrato
            System.Threading.Thread.Sleep(6000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(3) > .menu > .menu-item:nth-child(9) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".menu-item:nth-child(9) > .expandida > .menu > .menu-item:nth-child(3) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".menu-item:nth-child(3) .menu-item:nth-child(3) .ng-binding")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("comboundefined")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("comboundefined")).SendKeys("bradesco");
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("strong")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormbaixaExtratoProcessamentoundefined_edt_corretora")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormbaixaExtratoProcessamentoundefined_edt_corretora")).SendKeys("matriz");
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("strong")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-default")).Click();
            {
                System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
                var element = driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]"));
                System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
                Actions builder = new Actions(driver);
                builder.MoveToElement(element).Perform();
            }
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".confirm")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-default:nth-child(1)")).Click();
            #endregion

            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #8
0
        public void QuitarRepasse()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            System.Threading.Thread.Sleep(10000);//Aguardando a pagina carregar
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Quitar Repasses
            System.Threading.Thread.Sleep(8000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(3) > .menu > .menu-item:nth-child(9) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(8000); //Aguardando a pagina carregar
            IWebElement btnQuitaRep = driver.FindElement(By.XPath("/html/body/div[5]/nav/div[3]/ul/li[18]/a"));
            MetodosNavega.NavegaScroll(driver, btnQuitaRep);
            System.Threading.Thread.Sleep(8000);
            driver.FindElement(By.CssSelector(".menu-item:nth-child(9) > .expandida > .menu > .menu-item:nth-child(4) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar

            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("//*[@id=\"menuEsquerda\"]/div[3]/ul/li[9]/div/ul/li[4]/div/ul/li[2]/a")).Click();
            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar

            System.Threading.Thread.Sleep(1500);
            driver.FindElement(By.Id("comboundefined")).Click();
            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("comboundefined")).SendKeys("francisco");
            System.Threading.Thread.Sleep(4000); //Aguardando a pagina carregar
            driver.FindElement(By.LinkText("FRANCISCO")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-default:nth-child(2)")).Click();
            System.Threading.Thread.Sleep(2000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn:nth-child(3)")).Click();
            {
                System.Threading.Thread.Sleep(6000); //Aguardando a pagina carregar
                var element = driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]"));
                System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
                Actions builder = new Actions(driver);
                System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
                builder.MoveToElement(element).Perform();
            }
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".confirm")).Click();
            System.Threading.Thread.Sleep(8000);
            #endregion

            IWebElement caixaConfirma = driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]"));

            if (caixaConfirma.Displayed)
            {
                caixaConfirma.Click();
            }

            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #9
0
        public void CadastraEndosso()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastrar Endosso
            //Informa o nome do cliente a ser pesquisado
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div/input")).SendKeys("fausto silva");
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div:nth-child(1) > vs-portal-consultas-directive > div > div > div > div:nth-child(3) > div > span > button")).Click();

            //Seleciona o resultado
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div/div[2]/div/div/div[2]/div[1]/div/div[3]/div/div[1]/div/h3/a")).Click();

            //inicia cadastro de documento
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.LinkText("Seguros")).Click();

            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-success")).Click();

            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).SendKeys("AIG");
            driver.FindElement(By.LinkText("AIG")).Click();

            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).SendKeys("automoveis");
            driver.FindElement(By.CssSelector("strong")).Click();

            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).SendKeys("geral");
            driver.FindElement(By.CssSelector("strong")).Click();

            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Clear();//Deixa o campo vazio
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).SendKeys("MATRIZ");
            driver.FindElement(By.LinkText("MATRIZ")).Click();

            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();

            //aba seguro
            System.Threading.Thread.Sleep(15000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[3]/div/vs-menu-responsivo/div/div[2]/div/div/ul/li[1]/a")).Click();

            //Novo endosso
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/div[2]/div/div[1]/button")).Click();

            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_tpmov_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_tpmov_codigo")).SendKeys("substituicao");
            driver.FindElement(By.LinkText("SUBSTITUICAO DE ITEM")).Click();

            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            driver.ExecuteJavaScript("window.scrollTo(0,123)");
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); //Aguardando a pagina carregar
            System.Threading.Thread.Sleep(9000);                                //Aguardando a pagina carregar
            driver.FindElement(By.LinkText("Seguro")).Click();
            #endregion
            //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #10
0
        public void CadastroPF()
        {
            #region Gera CPF
            String GerarCpf()
            {
                int soma = 0, resto = 0;

                int[] multiplicador1 = new int[9] {
                    10, 9, 8, 7, 6, 5, 4, 3, 2
                };
                int[] multiplicador2 = new int[10] {
                    11, 10, 9, 8, 7, 6, 5, 4, 3, 2
                };

                Random rnd     = new Random();
                string semente = rnd.Next(100000000, 999999999).ToString();

                for (int i = 0; i < 9; i++)
                {
                    soma += int.Parse(semente[i].ToString()) * multiplicador1[i];
                }

                resto = soma % 11;
                if (resto < 2)
                {
                    resto = 0;
                }
                else
                {
                    resto = 11 - resto;
                }

                semente = semente + resto;
                soma    = 0;

                for (int i = 0; i < 10; i++)
                {
                    soma += int.Parse(semente[i].ToString()) * multiplicador2[i];
                }

                resto = soma % 11;

                if (resto < 2)
                {
                    resto = 0;
                }
                else
                {
                    resto = 11 - resto;
                }

                semente = semente + resto;
                return(semente);
            }

            #endregion

            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastrar Cliente PF
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            System.Threading.Thread.Sleep(1000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(3) > ul > li:nth-child(2) > a > span")).Click();
            System.Threading.Thread.Sleep(1000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div > form > div.paddingCard.col-lg-7.col-md-12.col-sm-12.col-xs-12 > div > div.clearfix.card-header.bg-card-teal > button")).Click();
            //Informa Nome
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_nome")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_nome")).SendKeys("FAUSTO SILVA");
            //Informa CPF



            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_cpf_cnpj")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_cpf_cnpj")).SendKeys(GerarCpf());
            //Informa data nascimento
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cli_data_nascimento")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();
            //Informa ponto de venda
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_pto_codigo")).Click();
            driver.FindElement(By.LinkText("MATRIZ")).Click();
            //Informa vendedor
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_vend_codigo")).Click();
            driver.FindElement(By.LinkText("FRANCISCO")).Click();
            //Informa Origem
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_cliori_codigo")).Click();
            driver.FindElement(By.LinkText("GERAL")).Click();

            driver.ExecuteJavaScript("window.scroll(0,1000)");//Executa js
            //Informa o endereço
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_tpender_codigo")).Click();
            driver.FindElement(By.LinkText("Residencial")).Click();
            //driver.FindElement(By.Id("campoCep")).Click();
            driver.FindElement(By.Id("campoCep")).SendKeys("84025-350");

            {
                var     element = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder = new Actions(driver);
                //builder.MoveToElement(element).Release().Perform();
            }
            //Salva
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.Name("frmAutoFormclientesundefined_edt_ender_numero")).SendKeys("350");
            driver.FindElement(By.CssSelector("div:nth-child(2) > .btn > span:nth-child(2)")).Click();
            #endregion
            //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void AutomacaoDeEmissao()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                //builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
            }

            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Automação de emissão
            //Clica em Automação de emissão
            System.Threading.Thread.Sleep(4000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("a:nth-child(4)")).Click();

            //Seleciona a cia
            System.Threading.Thread.Sleep(4000);               //Aguardando a pagina carregar
            driver.ExecuteJavaScript("window.scroll(0,1000)"); //Scroll na tela
            driver.FindElement(By.CssSelector("div:nth-child(9) > div > div.col-xs-10")).Click();

            //Desmarca
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[4]/div/div[1]/div/spam[2]")).Click();


            //Marcar somente um
            driver.ExecuteJavaScript("window.scrollTo(0,1000)");
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div:nth-child(4) > div > div.card-body.card-padding.row.scroll-arquivos > div > div:nth-child(2) > table > tbody > tr:nth-child(1) > td:nth-child(1) > vs-editavel3 > div > label > span")).Click();

            //Continuar
            driver.FindElement(By.CssSelector(".btn-md")).Click();

            //Clica para sair da mensagem
            System.Threading.Thread.Sleep(9000);//Aguardando a pagina carregar
            //ESC para fechar a tela de dados da importação
            Actions action = new Actions(driver);
            action.SendKeys(Keys.Escape).Perform();
            //driver.FindElement(By.CssSelector("div.ngdialog-overlay")).Click();

            //Gravar
            System.Threading.Thread.Sleep(2000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-md")).Click();

            //Editar (Lápis)
            System.Threading.Thread.Sleep(15000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[1]/div[2]/table/tbody/tr/td[7]/div[1]/span[1]")).Click();

            //Ponto de venda
            driver.FindElement(By.CssSelector(".col-lg-12:nth-child(2) > .col-lg-3:nth-child(3) #comboundefined")).Click();
            driver.FindElement(By.CssSelector(".col-lg-12:nth-child(2) > .col-lg-3:nth-child(3) #comboundefined")).SendKeys("matriz");
            driver.FindElement(By.CssSelector("strong")).Click();

            //Origem
            driver.FindElement(By.CssSelector(".col-lg-12:nth-child(4) #comboundefined")).Click();
            driver.FindElement(By.CssSelector(".col-lg-12:nth-child(4) #comboundefined")).SendKeys("geral");
            driver.FindElement(By.CssSelector("strong")).Click();

            //Comissao
            driver.FindElement(By.CssSelector(".ng-invalid .form-control")).Click();
            for (int i = 0; i < 4; i++)
            {
                driver.FindElement(By.CssSelector(".ng-invalid .form-control")).SendKeys(Keys.Backspace);
            }
            driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[6]/div[1]/div[2]/vs-editavel3/div/input")).SendKeys("20,00");
            //driver.FindElement(By.CssSelector(".ng-invalid .form-control")).SendKeys(Keys.Delete);



            //Vendedor
            driver.ExecuteJavaScript("window.scroll(0,2000)");
            driver.FindElement(By.CssSelector(".row:nth-child(10) > .col-lg-12:nth-child(1) #comboundefined")).Click();
            driver.FindElement(By.CssSelector(".row:nth-child(10) > .col-lg-12:nth-child(1) #comboundefined")).SendKeys("francisco");
            driver.FindElement(By.CssSelector("strong")).Click();

            //Salvar
            driver.FindElement(By.CssSelector(".col-lg-12:nth-child(8) > .pull-right:nth-child(1)")).Click();
            #endregion

            //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void CadastroCredencial()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Menu
            // Clica Menu Lateral
            System.Threading.Thread.Sleep(2000);//Para aguardar a tela carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            // Usando o menu pesquisa
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.Id("pesquisaMenu")).SendKeys("Senhas");
            driver.FindElement(By.CssSelector("div:nth-child(3) > ul > li > a")).Click();
            // Espera para carregar
            System.Threading.Thread.Sleep(2000);

            driver.FindElement(By.CssSelector("div:nth-child(3) > ul > li > div > ul > li > a")).Click();
            System.Threading.Thread.Sleep(2000);
            //Armazena o ID da janela
            string originalWindow = driver.CurrentWindowHandle;
            // Verifica se tem mais janelas abertas
            Assert.AreEqual(driver.WindowHandles.Count, 1);
            // Clica em "Acessar Central de Senhas" |
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.CssSelector("div:nth-child(3) > ul > li > div > ul > li > div > ul > li > a")).Click();
            #endregion

            #region Abrir a Central de Senhas
            System.Threading.Thread.Sleep(2000);
            //Loop até achar a nova guia
            foreach (string window in driver.WindowHandles)
            {
                if (originalWindow != window)
                {
                    driver.SwitchTo().Window(window);
                    break;
                }
            }
            // Seleciona Bradesco
            System.Threading.Thread.Sleep(12000);
            driver.FindElement(By.XPath("/html/body/div[2]/div[2]/div[1]/div[1]/div[2]/div/div[10]/div")).Click();
            // Clica em incluir
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.CssSelector(".icone-redondo")).Click();
            //
            driver.FindElement(By.CssSelector(".col-lg-12 > .ng-pristine .form-control")).Click();
            // Clica em descrição
            driver.FindElement(By.CssSelector("div:nth-child(2) > div:nth-child(2) > div.col-lg-8.ng-scope > div:nth-child(1) > div > div > div > div.card-body.card-padding.row > div:nth-child(1) > vs-editavel3 > div > input")).SendKeys("ROBO TESTE " + MetodosNavega.DiaDeHoje());
            // Clica em usuario |
            driver.FindElement(By.CssSelector(".col-lg-6 .ng-valid-maxlength")).Click();
            // Informa o usuario | 06564836953
            driver.FindElement(By.CssSelector(".col-lg-6 .ng-valid-maxlength")).SendKeys("06564836953");
            // Clica em senha |
            driver.FindElement(By.CssSelector(".ng-scope > .form-control-wrapper > .form-control")).Click();
            // Informa Senha | B115087F
            driver.FindElement(By.CssSelector(".ng-scope > .form-control-wrapper > .form-control")).SendKeys("B115087F");
            // Clica em situação |id=comboundefined |
            driver.FindElement(By.Id("comboundefined")).Click();
            // Seleciona Ativo |linkText=Ativo |
            driver.FindElement(By.LinkText("Ativo")).Click();
            // Clica em Produtor |
            driver.FindElement(By.CssSelector(".ng-scope > .ng-pristine #comboundefined")).Click();
            // Seleciona Produtor
            driver.FindElement(By.LinkText("Produtor")).Click();
            //
            driver.FindElement(By.CssSelector(".ng-scope:nth-child(2) > .card-virtual .icone-redondo")).Click();
            //
            driver.FindElement(By.CssSelector(".col-lg-5 .form-control")).Click();
            //
            driver.FindElement(By.CssSelector(".col-lg-5 .form-control")).SendKeys("425792-643");
            // Clica Inspetoria |
            driver.FindElement(By.CssSelector("div:nth-child(2) > div:nth-child(2) > div.col-lg-8.ng-scope > div:nth-child(2) > div > div.card-body.card-padding.row > div > vs-editavel3:nth-child(2) > div > input")).Click();
            // Informa Inspetoria
            driver.FindElement(By.CssSelector("div:nth-child(2) > div:nth-child(2) > div.col-lg-8.ng-scope > div:nth-child(2) > div > div.card-body.card-padding.row > div > vs-editavel3:nth-child(2) > div > input")).SendKeys("018");
            // Salva
            driver.FindElement(By.CssSelector(".btn:nth-child(1) > .visible-lg")).Click();
            #endregion



            // driver.Quit();
        }
        public void CadastraSinistro()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastrar Sinistro
            //Seleciona o campo de busca
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div/input")).SendKeys("fausto silva");

            //Clicar no busca
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div:nth-child(1) > vs-portal-consultas-directive > div > div > div > div:nth-child(3) > div > span > button")).Click();

            //Seleciona o cliente na lista
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div > div.col-sm-12.col-lg-9 > div > div > div:nth-child(2) > div.col-lg-12.col-md-12.col-sm-12 > div > div.card-body.card-padding.ng-scope > div > div:nth-child(1) > div > h3 > a")).Click();

            //Clicar em seguros
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[3]/div/vs-menu-responsivo/div/div[2]/div/div/ul/li[2]/a")).Click();

            //Acessar um documento
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.CssSelector("tbody > tr.odd > td:nth-child(1) > button")).Click();

            //Clicar em sinistros
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.CssSelector("div.col-xs-10.col-sm-10.col-lg-10.tab-menu-topo > div > vs-menu-responsivo > div > div.scrtabs-tabs-fixed-container > div > div > ul > li:nth-child(2) > a")).Click();

            //Clicar em incluir
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.CssSelector(".btn-raised")).Click();
            driver.ExecuteJavaScript("window.scroll(0,100)");

            //Clicar em data do sinistro
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.Name("frmAutoFormdocumentosSinistrosundefined_edt_sin_data_sinistro")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();

            //Gravar
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            #endregion
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #14
0
        public void RelacionamentosComCliente()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                try {
                    System.Threading.Thread.Sleep(5000);
                    var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                    Actions builder  = new Actions(driver);
                    System.Threading.Thread.Sleep(5000);
                    builder.MoveToElement(elemento).Release().Perform();
                }
                catch (Exception ex)
                {
                    IWebElement   comboBase  = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select"));
                    SelectElement optionBase = new SelectElement(comboBase);
                    optionBase.SelectByValue("Main");
                }
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion



            #region Central de relacionamento
            System.Threading.Thread.Sleep(6000);     //Aguardando a pagina carregar
            driver.FindElement(By.Id("botaoMenu")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(3) > .menu > .menu-item:nth-child(8) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".menu-item:nth-child(8) > .expandida > .menu > .menu-item:nth-child(1) > .menu-span > .ng-binding")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".menu-item:nth-child(1) .menu-item:nth-child(1) .ng-binding")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.Id("comboundefined")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.Id("comboundefined")).SendKeys("francisco");
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("strong")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".form-group:nth-child(4) .check")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_data1")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_data1")).SendKeys("24/04/1994");
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_data2")).Click();
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_data2")).SendKeys("24/04/1994");
            System.Threading.Thread.Sleep(3000);     //Aguardando a pagina carregar
            {
                System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
                var element = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[1]/div/ul/li[2]/div[2]/div"));
                System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
                Actions builder = new Actions(driver);
                System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
                builder.MoveToElement(element).Perform();
            }
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.LinkText("Dados do documento")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_doc_apolice")).Click();
            driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_doc_apolice")).Clear();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            // driver.FindElement(By.Name("frmAutoFormcentralRelacClientesSelecaoundefined_edt_doc_apolice")).SendKeys("VariosItens");
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.ExecuteJavaScript("window.scroll(0,1000)");
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-default")).Click();
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".check")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".check")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".check")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-default:nth-child(2)")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".col-lg-3 > .ng-pristine span")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".modal-footer > .btn")).Click();
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".col-sm-12 > .ng-pristine .ng-valid-maxlength")).Click();
            System.Threading.Thread.Sleep(8000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/email/div/div/div[3]/div/div/div[2]/div[6]/vs-editavel3/div/input")).SendKeys("teste regressivo");
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".mfb-component__main-icon--active")).Click();
            System.Threading.Thread.Sleep(5000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/email/ul/li/a")).Click();
            #endregion

            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void CadastroPFApolice()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                //builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastro de Apolice
            //Busca o cliente
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div/input")).SendKeys("fausto silva");
            //Clica na busca
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div:nth-child(1) > vs-portal-consultas-directive > div > div > div > div:nth-child(3) > div > span > button")).Click();

            //Selecionar o cliente buscado
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div/div[2]/div/div/div[2]/div[1]/div/div[3]/div/div[1]/div/h3/a")).Click();

            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            //Clicar em Seguros
            driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[3]/div/vs-menu-responsivo/div/div[2]/div/div/ul/li[2]/a")).Click();

            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            //Clicar em Incluir
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/vs-relacao3/div/div/div/div/div/div/div[1]/button")).Click();

            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            //Campo Apolice
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_doc_apolice")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_doc_apolice")).SendKeys("123456");

            //Campo Cia
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_cia_codigo")).SendKeys("amil");
            driver.FindElement(By.LinkText("AMIL")).Click();

            //Campo Produto
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_ramo_codigo")).SendKeys("empresarial");
            driver.FindElement(By.LinkText("EMPRESARIAL")).Click();

            //Campo Origem
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_docori_codigo")).SendKeys("geral");
            driver.FindElement(By.LinkText("GERAL")).Click();

            //Campo Ponto de Venda
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Click();
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).Clear();//Deixa o campo vazio
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_pto_codigo")).SendKeys("MATRIZ");
            driver.FindElement(By.LinkText("MATRIZ")).Click();

            //Data de Emissão
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_doc_data_emissao")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();

            //Data de entrada
            driver.FindElement(By.Name("frmAutoFormdocumentosundefined_edt_doc_data_entrada")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();

            //Salvar
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            #endregion
            System.Threading.Thread.Sleep(8000);
            driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]")).Click();
            //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void AutomacaoDeProposta()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            System.Threading.Thread.Sleep(8000);
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion
            bool sucesso = false;
            int  i       = 0;
            while (sucesso == false)
            {
                #region Automacao de Proposta
                System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
                                                     //Seleciona Automação
                driver.FindElement(By.CssSelector(".icon-file-empty:nth-child(2)")).Click();

                //Seleciona a Cia
                System.Threading.Thread.Sleep(10000);//Aguardando a pagina carregar
                driver.FindElement(By.CssSelector("div:nth-child(8) > div > div.col-xs-10")).Click();

                //Desmarcar
                try
                {
                    System.Threading.Thread.Sleep(6000);//Aguardando a pagina carregar
                    driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[4]/div/div[2]/div/div[2]/table/tbody/tr[1]/td[1]/vs-editavel3/div/label")).Click();
                    //driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div:nth-child(4) > div > div.clearfix.card-header.bg-card-teal > div > spam:nth-child(2)")).Click();
                }
                catch (Exception ex)//Caso não tenha o botão desmarcar o sistema irá avisar
                {
                    i = 1;
                    break;

                    throw new Exception("Não há arquivos baixados pelo feeder" + Environment.NewLine + ex.Message + (ex.InnerException != null ? ex.InnerException.ToString() : String.Empty));
                }
                sucesso = true;

                driver.ExecuteJavaScript("window.scrollTo(0,1000)");


                //Marcar somente um
                driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div > div:nth-child(4) > div > div.card-body.card-padding.row.scroll-arquivos > div > div:nth-child(2) > table > tbody > tr:nth-child(1) > td:nth-child(1) > vs-editavel3 > div > label > span")).Click();

                //Continuar
                driver.FindElement(By.CssSelector(".btn-md")).Click();
                System.Threading.Thread.Sleep(50000);
                //Clique para sair mensagem
                System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
                Actions action = new Actions(driver);
                action.SendKeys(Keys.Escape).Perform();



                //Gravar
                System.Threading.Thread.Sleep(30000);//Aguardando a pagina carregar
                //if (driver.FindElement(By.XPath("//*[@id=\"ngdialog1\"]/div[1]")).Displayed) {
                // driver.FindElement(By.XPath("//*[@id=\"ngdialog1\"]/div[1]")).Click();
                /// }
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div[5]/div/div/button")).Click();
                System.Threading.Thread.Sleep(10000);
                bool validaExistCobertura = driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[1]/h3")).Displayed;
                if (validaExistCobertura)
                {
                    if (driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[1]/h3")).Text.ToString().Trim() == "Parametrização de coberturas e parâmetros de importação PDF")
                    {
                        string textoCobertura = driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/table/tbody/tr/td[1]")).Text;
                        driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/table/tbody/tr/td[2]/div[3]/div[1]/vs-editavel3/div/input")).SendKeys("cobertura geral robo");
                        driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/table/tbody/tr/td[2]/div[3]/div[1]/vs-editavel3/div/input")).SendKeys(Keys.Tab);
                        driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/div/table/tbody/tr/td[2]/div[3]/div[1]/vs-editavel3/div/input")).SendKeys(Keys.Tab);
                        driver.FindElement(By.XPath("/html/body/div[12]/div[2]/div[2]/div/button[1]")).Click();
                        string textoDeConfirmacao = driver.FindElement(By.XPath("/html/body/div[13]/div[2]/div[3]/div/div/div[1]/div[1]/label")).Text.Trim();
                        driver.FindElement(By.XPath("/html/body/div[13]/div[2]/div[3]/div/div/div[1]/div[2]/input")).SendKeys(textoDeConfirmacao);
                        driver.FindElement(By.XPath("/html/body/div[13]/div[2]/div[3]/div/div/div[2]/button")).Click();
                        System.Threading.Thread.Sleep(8000);
                    }
                }

                //Editar (lápis)
                System.Threading.Thread.Sleep(15000);//Aguardando a pagina carregar
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div/button[2]")).Click();



                //Ponto de venda
                System.Threading.Thread.Sleep(15000);//Aguardando a pagina carregar
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(2) > .col-lg-3:nth-child(3) #comboundefined")).Click();
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(2) > .col-lg-3:nth-child(3) #comboundefined")).Clear();
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(2) > .col-lg-3:nth-child(3) #comboundefined")).SendKeys("matriz");
                driver.FindElement(By.CssSelector("strong")).Click();

                //Origem
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(4) #comboundefined")).Click();
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(4) #comboundefined")).Clear();
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(4) #comboundefined")).SendKeys("geral");
                driver.FindElement(By.CssSelector("strong")).Click();

                //Vendedor
                driver.ExecuteJavaScript("window.scroll(0,1000)");//Scroll na tela
                driver.FindElement(By.CssSelector(".row:nth-child(10) > .col-lg-12:nth-child(1) #comboundefined")).Click();
                driver.FindElement(By.CssSelector(".row:nth-child(10) > .col-lg-12:nth-child(1) #comboundefined")).SendKeys("francisco");
                driver.FindElement(By.CssSelector("strong")).Click();

                //Gravar documento
                driver.FindElement(By.CssSelector(".col-lg-12:nth-child(8) > .pull-right:nth-child(1)")).Click();

                #endregion
            }
            if (i == 1)
            {
                Assert.IsFalse(sucesso);
            }
            //Fecha o Navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #17
0
        public void FechaNegocio()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                //builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Fechar Negocio
            //Buscando negocio cadastrado hoje

            int dia = DateTime.Now.Day;
            int mes = DateTime.Now.Month;
            int ano = DateTime.Now.Year;

            string agora;

            if (dia < 9)
            {
                agora = "0" + dia.ToString();
                agora = agora + "0" + mes.ToString();
                agora = agora + ano.ToString();
            }
            else
            {
                agora = dia.ToString();
                agora = agora + "0" + mes.ToString();
                agora = agora + ano.ToString();
            }



            System.Threading.Thread.Sleep(10000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".zmdi-case:nth-child(2)")).Click();
            System.Threading.Thread.Sleep(10000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[2]/vs-editavel3/div/input")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[2]/vs-editavel3/div/input")).SendKeys(Keys.Control + "A");
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[2]/vs-editavel3/div/input")).SendKeys(Keys.Backspace);
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[2]/vs-editavel3/div/input")).Click();
            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[2]/vs-editavel3/div/input")).SendKeys("09/06/2021");
            driver.FindElement(By.CssSelector(".col-xs-12:nth-child(1) .col-xs-4:nth-child(3) .form-control")).Click();
            driver.FindElement(By.CssSelector(".col-xs-12:nth-child(1) .col-xs-4:nth-child(3) .form-control")).SendKeys(Keys.Backspace);
            driver.FindElement(By.CssSelector(".col-xs-12:nth-child(1) .col-xs-4:nth-child(3) .form-control")).Clear();
            driver.FindElement(By.CssSelector(".col-xs-12:nth-child(1) .col-xs-4:nth-child(3) .form-control")).SendKeys("09/06/2021");
            driver.FindElement(By.CssSelector(".col-xs-12:nth-child(1) .col-xs-4:nth-child(3) .form-control")).SendKeys(Keys.Tab);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[7]/vs-editavel3/div/input")).Clear();
            //driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div.row > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral.col-menu-vert-11 > div:nth-child(1) > div:nth-child(2) > div > div > div > button")).Click();
            driver.FindElement(By.Id("combovendedorBusca")).Clear();
            driver.FindElement(By.Id("combovendedorBusca")).SendKeys("Fran");
            System.Threading.Thread.Sleep(5000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[1]/div[2]/div/div[8]/vs-editavel3/div/ul/li[1]/a")).Click();
            System.Threading.Thread.Sleep(5000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/div[2]/div/div/div/button")).Click();
            //Clicar no negocio que sera fechado
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("tbody > tr > td:nth-child(1) > button > i")).Click();

            //Fechar negocio

            System.Threading.Thread.Sleep(8000); //Aguardando a pagina carregar
            driver.FindElement(By.LinkText("Fechar negócio")).Click();
            System.Threading.Thread.Sleep(5000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector("div:nth-child(73) > div.sweet-alert.show-sweet-alert.visible > button.confirm")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.Name("frmAutoFormfecharNegocioundefined_edt_cn_orc_inicio_vigencia")).Click();
            DateTime dataHoje = DateTime.Today;
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Control + "A");
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Delete);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).SendKeys(dataHoje.ToShortDateString());
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Tab);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Tab);
            System.Threading.Thread.Sleep(3000);//Aguardando a pagina carregar

            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[1]/div/vs-editavel3/div/input")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Down);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Enter);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[4]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[1]/div/vs-editavel3/div/input")).SendKeys(Keys.Tab);

            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div.row > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral.col-menu-vert-11 > div:nth-child(5) > div.botoes-bottom.botoes-bottom-calcular-todas.ng-scope > div > div > button")).Click();
            #endregion
            //Fecha o navegador
            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
        public void CadastraNegocio()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }
            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            #endregion

            #region Cadastro do Negócio
            //Central de Negocios
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[2]/div/a[1]/div/div")).Click();
            System.Threading.Thread.Sleep(3000); //Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".btn-success")).Click();
            //Criando o negocio
            System.Threading.Thread.Sleep(6000);//Aguardando a pagina carregar
            driver.FindElement(By.CssSelector(".col-lg-3:nth-child(2) .ng-valid-mask")).Click();
            driver.FindElement(By.CssSelector(".col-lg-3:nth-child(2) .ng-valid-mask")).SendKeys("300.300.300-30");
            driver.FindElement(By.CssSelector(".col-lg-3:nth-child(3) #comboundefined")).Click();
            driver.FindElement(By.CssSelector(".col-lg-8:nth-child(1) .card-body")).Click();
            driver.ExecuteJavaScript("window.scroll(0,1000)");
            System.Threading.Thread.Sleep(3000);
            MetodosNavega.NavegaScroll(driver, "//*[@id=\"comboundefined\"]", 2);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div[1]/vs-editavel3/div/input")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[3]/div[2]/div/div[2]/div[2]/div[1]/vs-editavel3/div/input")).SendKeys("aero");
            driver.FindElement(By.LinkText("AERONAUTICO")).Click();
            driver.FindElement(By.CssSelector(".col-lg-3:nth-child(3) .empty")).Click();
            driver.FindElement(By.CssSelector(".today")).Click();
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).Click();
            //driver.ExecuteScript("document.getElementById("combopontos").select()");
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).SendKeys("m");
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).SendKeys("a");
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).SendKeys("t");
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).SendKeys("r");
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).SendKeys("i");
            driver.FindElement(By.CssSelector(".col-lg-12 #combopontos")).SendKeys("z");
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.LinkText("MATRIZ")).Click();
            driver.FindElement(By.Id("combovendedor")).Click();
            driver.FindElement(By.Id("combovendedor")).SendKeys("F");
            driver.FindElement(By.Id("combovendedor")).SendKeys("R");
            driver.FindElement(By.Id("combovendedor")).SendKeys("A");
            driver.FindElement(By.Id("combovendedor")).SendKeys("N");
            driver.FindElement(By.Id("combovendedor")).SendKeys("C");
            driver.FindElement(By.Id("combovendedor")).SendKeys("I");
            driver.FindElement(By.Id("combovendedor")).SendKeys("S");
            driver.FindElement(By.Id("combovendedor")).SendKeys("C");
            driver.FindElement(By.Id("combovendedor")).SendKeys("O");
            //driver.FindElement(By.Id("combovendedor")).Click();
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.LinkText("FRANCISCO")).Click();
            driver.FindElement(By.CssSelector("div:nth-child(2) > .botoes-bottom-verde")).Click();
            //js.ExecuteScript("window.scrollTo(0,574)");

            //Fecha o navegador

            #endregion

            MetodosNavega.SairPlus(driver);

            driver.Quit();
        }
Example #19
0
        public void RenovaApolice()
        {
            #region Abrir o Chrome
            //inicializando o chrome
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("http://main.safety8.local/#/login?cnpj=72.408.271%2F0001-91");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            #endregion

            #region Login
            var cnpj = driver.FindElement(By.Id("cnpj"));
            cnpj.SendKeys("72408271000191");
            {
                var     elemento = driver.FindElement(By.CssSelector(".logo-login-q"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).ClickAndHold().Perform();
            }
            {
                var     elemento = driver.FindElement(By.CssSelector(".efeitoOverlay"));
                Actions builder  = new Actions(driver);
                builder.MoveToElement(elemento).Release().Perform();
            }
            driver.FindElement(By.CssSelector(".container-fluid")).Click();
            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            {
                var dropdown = driver.FindElement(By.CssSelector(".ng-scope > .animated"));
                dropdown.FindElement(By.XPath("/html/body/div[5]/div[2]/div[2]/div/div/div/div/div/div[2]/div[2]/select/option[3]")).Click();
                //driver.Quit();
            }

            Login login = new Login();

            driver.FindElement(By.CssSelector(".ng-scope > .animated")).Click();
            driver.FindElement(By.Id("usuario")).Click();
            driver.FindElement(By.Id("usuario")).SendKeys(login.RetornaUsuario());
            driver.FindElement(By.Id("senha")).SendKeys(login.RetornaSenha());
            driver.FindElement(By.CssSelector(".button-login-q")).Click();
            bool sucessoNoTeste = false;
            #endregion

            #region Renovar Apolice
            //Realizar a busca
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div")).Click();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[1]/vs-portal-consultas-directive/div/div/div/div[3]/div/input")).SendKeys("fausto silva");

            //Clicar no busca
            driver.FindElement(By.CssSelector("div:nth-child(5) > div.container-fluid > div:nth-child(3) > div.index-conteudo.ng-scope.animated.fadeIn.conteudo-geral > div:nth-child(1) > vs-portal-consultas-directive > div > div > div > div:nth-child(3) > div > span > button")).Click();

            //Clicar no cliente
            System.Threading.Thread.Sleep(8000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/div/div[2]/div/div/div[2]/div[1]/div/div[3]/div/div[1]/div/h3/a")).Click();

            //Clicar em seguros
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[1]/nav/div[3]/div/vs-menu-responsivo/div/div[2]/div/div/ul/li[2]/a")).Click();

            //Clica no documento
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div/vs-relacao3/div/div/div/div/div/div/div[2]/div[2]/table/tbody/tr[1]/td[1]/button/i")).Click();

            //Clica em renovar
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/div[1]/div/form/div/div/div[1]/button")).Click();

            //Clicar em Sim
            System.Threading.Thread.Sleep(5000);//Aguardando a pagina carregar
            driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]")).Click();
            #endregion

            //Edita o documento após renovar.
            System.Threading.Thread.Sleep(9000);
            driver.FindElement(By.XPath("//*[@id=\"movimentacoes\"]/div/div[2]/div/div[1]/div[2]/h3")).Click();
            System.Threading.Thread.Sleep(5000);


            bool alertaNaTela = driver.FindElement(By.XPath("/html/body/div[7]/div[2]/p")).Displayed;

            if (alertaNaTela)
            {
                string alerta = driver.FindElement(By.XPath("/html/body/div[7]/div[2]/p")).Text;

                if (alerta == "Verifique o percentual de corretagem do documento.")
                {
                    driver.FindElement(By.XPath("/html/body/div[7]/div[2]/button[1]")).Click();
                }
            }

            System.Threading.Thread.Sleep(3000);
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/vs-botoes3/div/div/div[1]/button[1]")).Click();
            System.Threading.Thread.Sleep(2000);

            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/div[3]/div/form/div[3]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).Clear();
            driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/div[3]/div/form/div[3]/div/div[2]/div[1]/div[1]/div/vs-editavel3/div/input")).SendKeys(MetodosNavega.DiaDeHoje());

            string btnSalvar = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/vs-botoes3/div/div/div[2]/button[1]/span[2]")).Text;
            if (btnSalvar == "S")
            {
                driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div[3]/div[4]/div[5]/vs-botoes3/div/div/div[2]/button[1]")).Click();
                sucessoNoTeste = true;
            }

            if (sucessoNoTeste)
            {
                MetodosNavega.SairPlus(driver);
            }
        }