コード例 #1
0
        public void PreparaCapturaTag()
        {
            IWebDriver driver = null;

            try
            {
                driver = new ChromeDriver();

                ReinciaTagsCapturados();

                int NumeroDeCptura = 0;

                while (FimProcess == true)
                {
                    string query = "select top 1 * from URLdoTemplate where DataEhora is null order by NumeroDaURL";

                    DataSet DS = DB.DS(query, "URLdoTemplate");

                    NumeroDeCptura++;

                    //IniciaURLdoTemplate(driver);

                    if (DS.Tables["URLdoTemplate"].Rows.Count > 0)
                    {
                        foreach (DataRow row in DS.Tables["URLdoTemplate"].Rows)
                        {

                            driver.Navigate().GoToUrl(row["URLdoLinks"].ToString().Replace("#", "")); //Navega na url especificada
                            Thread.Sleep(2500);

                            CapturaTagImput(driver);

                            CapturaTagA(driver, NumeroDeCptura, row["NumeroDaURL"].ToString());

                            PercorreTagsImput(driver, row["NumeroDaURL"].ToString());

                            AtualizaURLTemplatesExecução(row["NumeroDaURL"].ToString());

                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("ERRO:" + ex.Message + ", Classe: Automacao, Método: PreparaCapturaElemento");
            }
            finally
            {
                driver.Close(); // fecha pagina do ChromeDriver
                driver.Quit();  // fecha prompt do ChromeDriver
            }
        }