Beispiel #1
0
        public bool CreateStrategicAutoPublication(SponsoringType sponsorType, string brandOrModelToCreate = null)
        {
            driver.FindElement(By.XPath("//*[@class='create']")).Click();
            driver.FindElement(By.XPath("//*[@id='nameTxtArea']")).SendKeys("qaDeautos" + DateTime.Now.ToString("ddhhmmss"));

            new SelectElement(driver.FindElement(By.XPath("//*[@id='type']"))).SelectByIndex((int)sponsorType);

            driver.FindElement(By.Id("inputPic")).SendKeys(Env.ImagesSponsor);

            driver.FindElement(By.XPath("//*[@id='urlTxtArea']")).SendKeys(Url.Deautos.Views.Home.Main);
            driver.FindElement(By.XPath("//*[@id='textTxtArea']")).SendKeys(FormData.Comment);

            driver.FindElement(By.Id("enabled")).Click();

            string brandOrModelAssociation = $"//*//div[@id='{sponsorType.ToString().ToLower()}sAssociation']//*//input";

            driver.FindElement(By.XPath(brandOrModelAssociation)).Click();

            if (brandOrModelToCreate != null)
            {
                driver.FindElement(By.XPath(brandOrModelAssociation)).SendKeys(brandOrModelToCreate);
            }

            driver.FindElement(By.XPath(brandOrModelAssociation)).SendKeys(Keys.Enter);

            driver.FindElement(By.XPath("//*[@type='submit']")).Click();

            return(driver.FindElement(By.XPath("//*[@class='alert alert-block alert-info']//*[contains(text(),'creado')]")).Displayed);
        }
        public bool CreateListingSponsor(SponsoringType sponsorType)
        {
            driver.FindElement(By.XPath("//*[@class='create']")).Click();

            new SelectElement(driver.FindElement(By.XPath("//*[@id='type']"))).SelectByIndex((int)sponsorType);

            driver.FindElement(By.XPath("//*[@id='txName']")).SendKeys("qaDeautos" + DateTime.Now.ToString("ddhhmmss"));

            var actions = new Actions(driver);

            actions.DoubleClick(driver.FindElement(By.XPath("//*[contains(text(),'Elige un usuario...')]"))).Build().Perform();

            driver.FindElement(By.XPath($"(//*[@id='mailSelector']//*[contains(text(),'{MultibrandUser}')])[2]")).Click();

            driver.Until(ElementIsVisible(By.XPath("//*[contains(text(),'Elige una publicación...')]")), FromSeconds(60));

            actions.DoubleClick(driver.FindElement(By.XPath("//*[contains(text(),'Elige una publicación...')]"))).Build().Perform();

            driver.FindElement(By.XPath("//*[@id='publicationSelector']//li[1]")).Click();
            driver.FindElement(By.XPath("//*[@id='locationSelector']//*[@class='jqtree-toggler btn-tree-expand']")).Click();
            driver.FindElement(By.XPath("(//*[@id='locationSelector']//*[@class='jqtree-title jqtree_common'])[1]")).Click();
            driver.FindElement(By.XPath("//*[@type='checkbox']")).Click();

            actions.Click(driver.FindElement(By.XPath($"//*//div[@id='{sponsorType.ToString().ToLower()}sAssociation']//*//input"))).SendKeys(Keys.Enter)
            .Build().Perform();

            driver.FindElement(By.XPath("//*[@type='submit']")).Click();

            return(driver.FindElement(By.XPath("//*[@class='alert alert-block alert-info']//*[contains(text(),'creado')]")).Displayed);
        }