Exemplo n.º 1
0
        public void getTextoLeroLero(DataParametros dados, int qtd)
        {
            //criarAba();
            driver.Navigate().GoToUrl("https://lerolero.com/");
            IWebElement botaoGerar      = driver.FindElement(By.Id("gerar-frase"));
            IWebElement textoAleartorio = driver.FindElement(By.XPath("//div[@class='sentence sentence-exited']"));

            for (int qt = 1; qt <= qtd; qt++)
            {
                botaoGerar.Click();
                string texto = textoAleartorio.GetAttribute("innerHTML");
                dados.texto.Add(texto);
                Thread.Sleep(new TimeSpan(0, 0, 3));
            }
        }
Exemplo n.º 2
0
        public void Login(DataParametros dados)
        {
            driver.Navigate().GoToUrl("https://pt-br.facebook.com/");
            var hasTitle = false;

            do
            {
                IWebElement email = driver.FindElement(By.XPath("//input[@type='text' or @id='email']"));
                IWebElement pass  = driver.FindElement(By.XPath("//input[@type='password' or @id='pass']"));
                IWebElement form  = driver.FindElement(By.XPath("//form[@method='post']"));
                email.Click();
                email.Clear();
                email.SendKeys(dados.email);
                pass.Click();
                pass.SendKeys(dados.senha);
                form.Submit();
                Thread.Sleep(new TimeSpan(0, 0, 10));
                hasTitle = driver.Title.Contains("Entrar");
            }while (hasTitle == true);
        }
Exemplo n.º 3
0
        public void incluirComentarios(DataParametros dados)
        {
            IWebElement buttonPerfil = driver.FindElement(By.XPath("//a[@title='Perfil']"));

            buttonPerfil.Click();
            Thread.Sleep(new TimeSpan(0, 0, 10));
            IWebElement bodyElement = driver.FindElement(By.TagName("body"));

            //for (int i = 1; i <= 10; i++)
            //{
            //    bodyElement.SendKeys(Keys.ArrowDown);
            //}

            Thread.Sleep(new TimeSpan(0, 0, 5));
            IWebElement buttonComment = driver.FindElement(By.XPath("//a[@label='Publicação']"));

            buttonComment.Click();

            foreach (string txt in dados.texto)
            {
                setMessage(txt);
            }
        }
        public DataParametros criaVerificaDoc()
        {
            Console.WriteLine("Rodando app no diretorio \n " + pathCompleto);

            DataParametros dados = new DataParametros();

            if (!File.Exists(pathCompleto))
            {
                File.Create(pathCompleto).Dispose();


                Console.WriteLine("Arquivo de parametro criado !");
                Console.WriteLine("Digite o E-mail a ser incluido automático !");
                var emailConsole = Console.ReadLine();
                Console.WriteLine("Digite a Senha a ser incluido automáticamente !");
                var senhaConsole = Console.ReadLine();
                Console.WriteLine("Digite alguns textos separado por ';' !");
                var textos = Console.ReadLine();
                using (StreamWriter stream = new StreamWriter(pathCompleto))
                {
                    stream.WriteLine("----------------------------------- PARAMETROS GERAIS ----------------------------------------------");
                    stream.WriteLine(" ");
                    stream.WriteLine(String.Format("Email={0};", emailConsole));
                    stream.WriteLine(" ");
                    stream.WriteLine(String.Format("Senha={0};", senhaConsole));
                    stream.WriteLine("---------------------------------------- TEXTOS GERAIS ------------------------------------------------------------ ");
                    stream.WriteLine(textos);
                }

                Console.WriteLine("Informações cadastradas !");
                dados.email = emailConsole.Trim();
                dados.senha = senhaConsole.Trim();
                var arrayTextos = textos.Split(';');
                dados.texto = new List <string>(arrayTextos);
            }
            else
            {
                Console.WriteLine("Arquivo já existe ! \n \n Verificando dados...");
                using (StreamReader reader = new StreamReader(pathCompleto))
                {
                    string linha;
                    bool   readEmail = false;
                    bool   readSenha = false;
                    bool   AreaTexto = false;

                    while ((linha = reader.ReadLine()) != null)
                    {
                        if (linha != null)
                        {
                            if (linha.Trim().Contains("Email"))
                            {
                                var splitEmail = linha.Split('=');
                                dados.email = splitEmail[1].Replace(';', ' ');
                                readEmail   = true;
                            }

                            if (linha.Trim().Contains("Senha"))
                            {
                                var splitSenha = linha.Split('=');
                                dados.senha = splitSenha[1].Replace(';', ' ');
                                readSenha   = true;
                                goto prox;
                            }

                            if (linha.Trim().Contains(";") && (readEmail == true && readSenha == true) || (AreaTexto == true))
                            {
                                dados.texto = new List <string>(linha.Split(';'));
                            }

                            if (linha.Trim().Contains("TEXTOS GERAIS"))
                            {
                                AreaTexto = true;
                            }

                            prox :;
                        }
                    }
                }
            }

            return(dados);
        }