예제 #1
0
        public void PreencherLook(IWebDriver driver, Look_Dao objLook)
        {
            var primeiroCampo = Tbutil.WaitForFirstExist(driver, Look_Map.TxtInserirNome(driver), 10);

            if (primeiroCampo == true)
            {
                if (!string.IsNullOrEmpty(objLook.InserirNome))
                {
                    Tbreport.GetScreenShot(driver, objLook.SearchNomeLook);
                    Look_Map.TxtInserirNome(driver).Clear();
                    Look_Map.TxtInserirNome(driver).SendKeys(objLook.InserirNome);
                }
                if (!string.IsNullOrEmpty(objLook.InserirCodigoInterno))
                {
                    Tbreport.GetScreenShot(driver, objLook.SearchNomeLook);
                    Look_Map.TxtInserirCodigoInterno(driver).Clear();
                    Look_Map.TxtInserirCodigoInterno(driver).SendKeys(objLook.InserirCodigoInterno);
                }
                if (!string.IsNullOrEmpty(objLook.InserirCodigoYoutube))
                {
                    Tbreport.GetScreenShot(driver, objLook.SearchNomeLook);
                    Look_Map.TxtInserirCodigoYoutube(driver).Clear();
                    Look_Map.TxtInserirCodigoYoutube(driver).SendKeys(objLook.InserirCodigoYoutube);
                }
                if (!string.IsNullOrEmpty(objLook.InserirStatus))
                {
                    if (objLook.InserirStatus == "Ativo")
                    {
                        Tbreport.GetScreenShot(driver, objLook.InserirStatus);
                        Look_Map.RdotInserirStatusAtivo(driver).Click();
                    }
                    else
                    {
                        Tbreport.GetScreenShot(driver, objLook.InserirStatus);
                        Look_Map.RdotInserirStatusInativo(driver).Click();
                    }
                }
                if (!string.IsNullOrEmpty(Convert.ToString(objLook.InserirDesconto)))
                {
                    Tbreport.GetScreenShot(driver, Convert.ToString(objLook.InserirDesconto));
                    Look_Map.TxtinserirDesconto(driver).Clear();
                    Look_Map.TxtinserirDesconto(driver).SendKeys(Convert.ToString(objLook.InserirDesconto));
                }
                if (!string.IsNullOrEmpty(Convert.ToString(objLook.InserirPorcentagem)))
                {
                    Tbreport.GetScreenShot(driver, Convert.ToString(objLook.InserirPorcentagem));
                    Look_Map.TxtinserirPorcentagem(driver).Clear();
                    Look_Map.TxtinserirPorcentagem(driver).SendKeys(Convert.ToString(objLook.InserirPorcentagem));
                }
                if (!string.IsNullOrEmpty(Convert.ToString(objLook.InserirFabricante)))
                {
                    if (objLook.InserirNovoFabricante == false)
                    {
                        Tbreport.GetScreenShot(driver, objLook.InserirFabricante);
                        Look_Map.TxtInserirSelecioneFabricante(driver).Clear();
                        Look_Map.TxtInserirSelecioneFabricante(driver).SendKeys(objLook.InserirFabricante);
                        Look_Map.TxtInserirSelecioneFabricante(driver).SendKeys(Keys.ArrowDown);
                        Look_Map.TxtInserirSelecioneFabricante(driver).SendKeys(Keys.Enter);
                        Look_Map.BtnInserirPesquisarCategoria(driver).Click();
                    }
                    else
                    {
                        Look_Map.HplInserirNovoFabricante(driver).Click();

                        driver.SwitchTo().Frame(driver.FindElement(By.Id("fancybox-frame")));

                        //Wait

                        if (!string.IsNullOrEmpty(Convert.ToString(objLook.NovoFabricanteCodigoInterno)))
                        {
                            Tbreport.GetScreenShot(driver, Convert.ToString(objLook.NovoFabricanteCodigoInterno));
                            Look_Map.TxtInserirFabricanteCodigoInterno(driver).Clear();
                            Look_Map.TxtInserirFabricanteCodigoInterno(driver).SendKeys(Convert.ToString(objLook.NovoFabricanteCodigoInterno));
                        }
                        if (!string.IsNullOrEmpty(Convert.ToString(objLook.NovoFabricanteNome)))
                        {
                            Tbreport.GetScreenShot(driver, objLook.NovoFabricanteNome);
                            Look_Map.TxtInserirFabricanteNome(driver).Clear();
                            Look_Map.TxtInserirFabricanteNome(driver).SendKeys(objLook.NovoFabricanteNome);
                        }
                        if (!string.IsNullOrEmpty(Convert.ToString(objLook.NovoFabricanteMenu)))
                        {
                            Tbreport.GetScreenShot(driver, objLook.NovoFabricanteMenu);
                            Look_Map.SelectInserirFabricanteMenu(driver).SelectByText(objLook.NovoFabricanteMenu);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(objLook.NovoFabricanteMenu)))
                        {
                            Tbreport.GetScreenShot(driver, objLook.NovoFabricanteMenu);
                            Look_Map.SelectInserirFabricanteMenu(driver).SelectByText(objLook.NovoFabricanteMenu);
                        }

                        Look_Map.BtnInserirFabricanteInserirFabricante(driver);

                        Look_Map.BtnInserirFabricanteClose(driver);

                        //wait

                        if (!string.IsNullOrEmpty(Convert.ToString(objLook.InserirFabricante)))
                        {
                            Tbreport.GetScreenShot(driver, objLook.InserirFabricante);
                            Look_Map.TxtInserirSelecioneFabricante(driver).Clear();
                            Look_Map.TxtInserirSelecioneFabricante(driver).SendKeys(objLook.InserirFabricante);
                            Look_Map.TxtInserirSelecioneFabricante(driver).SendKeys(Keys.ArrowDown);
                            Look_Map.TxtInserirSelecioneFabricante(driver).SendKeys(Keys.Enter);
                            Look_Map.BtnInserirPesquisarCategoria(driver).Click();
                        }
                    }
                }

                Look_Map.ChbInserirResultadoPesquisaCategoria(driver).Click();

                Look_Map.BtnInserirAdicionarCategoria(driver).Click();

                if (!string.IsNullOrEmpty(objLook.InserirDescricao))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirDescricao);
                    Look_Map.TxtInserirDescricao(driver).Clear();
                    Look_Map.TxtInserirDescricao(driver).SendKeys(objLook.InserirDescricao);
                }
                if (!string.IsNullOrEmpty(objLook.InserirLongPage))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirLongPage);
                    Look_Map.TxtInserirLongPage(driver).Clear();
                    Look_Map.TxtInserirLongPage(driver).SendKeys(objLook.InserirLongPage);
                }
                if (!string.IsNullOrEmpty(objLook.InserirOcasiao))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirOcasiao);
                    Look_Map.TxtInserirFiltroOcasiao(driver).Clear();
                    Look_Map.TxtInserirFiltroOcasiao(driver).SendKeys(objLook.InserirOcasiao);
                    Look_Map.BtnInserirFiltroOcasiao(driver).Click();
                }
                if (!string.IsNullOrEmpty(objLook.InserirEstilo))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirEstilo);
                    Look_Map.TxtInserirFiltroEstilo(driver).Clear();
                    Look_Map.TxtInserirFiltroEstilo(driver).SendKeys(objLook.InserirEstilo);
                    Look_Map.BtnInserirFiltroEstilo(driver).Click();
                }
                if (!string.IsNullOrEmpty(objLook.InserirTendencia))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirEstilo);
                    Look_Map.TxtInserirFiltroTendencia(driver).Clear();
                    Look_Map.TxtInserirFiltroTendencia(driver).SendKeys(objLook.InserirTendencia);
                    Look_Map.BtnInserirFiltroTendencia(driver).Click();
                }
                if (!string.IsNullOrEmpty(objLook.InserirNomeProduto))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirNomeProduto);
                    Look_Map.TxtInserirNomeProduto(driver).Clear();
                    Look_Map.TxtInserirNomeProduto(driver).SendKeys(objLook.InserirNomeProduto);
                }
                if (!string.IsNullOrEmpty(objLook.InserirCodigoInternoProduto))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirCodigoInternoProduto);
                    Look_Map.TxtInserirCodigoInternoProduto(driver).Clear();
                    Look_Map.TxtInserirCodigoInternoProduto(driver).SendKeys(objLook.InserirCodigoInternoProduto);
                    Look_Map.BtnInserirProduto(driver).Click();
                }

                Look_Map.RdoInserirResultadoProduto(driver).Click();

                Look_Map.ChbInserirSkuProduto(driver).Click();

                if (!string.IsNullOrEmpty(Convert.ToString(objLook.InserrirQuantidadeProdutoSkuSelecionado)))
                {
                    Tbreport.GetScreenShot(driver, objLook.InserirCodigoInternoProduto);
                    Look_Map.ChbInserirQuantidadeProduto(driver).Clear();
                    Look_Map.ChbInserirQuantidadeProduto(driver).SendKeys(Convert.ToString(objLook.InserrirQuantidadeProdutoSkuSelecionado));
                }

                Look_Map.BtnInserirSalvar(driver).Click();
            }
        }