コード例 #1
0
        /// <summary>
        /// Get all the statuses list in Status dropdown
        /// </summary>
        /// <param name="Status"></param>
        /// <returns></returns>
        public IList <string> GetCatalogStatusFromStatusDropdown(string[] Status = null)
        {
            UtilityMethods.ClickElement(webDriver, SelectStatusSpan);
            IList <IWebElement> allStatusesList = webDriver.FindElements(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']"));

            return(allStatusesList.Select(c => c.Text).ToList());
        }
コード例 #2
0
        public void SelectOption(IWebElement webElement, string optionText)
        {
            optionText = optionText.ToUpper();
            webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMinutes(1));
            UtilityMethods.ClickElement(webDriver, webElement);
            IWebElement textElement = webElement.FindElement(By.XPath("div/ul/child::li/a/div/strong[translate(text(),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='" + optionText + "']"));

            UtilityMethods.ClickElement(webDriver, textElement);
        }
コード例 #3
0
 public void SelectEnvironmentProdOrPrev(B2BEnvironment b2BEnvironment)
 {
     if (b2BEnvironment == B2BEnvironment.Production)
     {
         UtilityMethods.ClickElement(webDriver, ProductionEnvRadioButton);
     }
     else if (b2BEnvironment == B2BEnvironment.Preview)
     {
         UtilityMethods.ClickElement(webDriver, PreviewEnvRadioButton);
     }
 }
コード例 #4
0
        /// <summary>
        /// Download catalog from Auto Catalog List & Inventory page
        /// </summary>
        /// <param name="identityName">Identity Name</param>
        /// <param name="anyTimeAfter">Time after which the catalog is processed</param>
        /// <returns>File name for the downloaded catalog</returns>
        public string DownloadCatalog(string identityName, DateTime anyTimeAfter)
        {
            UtilityMethods.ClickElement(_webDriver, GetDownloadButton(1));
            string downloadPath = ConfigurationManager.AppSettings["CatalogDownloadPath"];

            _webDriver.WaitForDownLoadToComplete(downloadPath, identityName, anyTimeAfter, TimeSpan.FromMinutes(1));
            string fileName = new DirectoryInfo(downloadPath).GetFiles().AsEnumerable()
                              .Where(file => file.Name.Contains(identityName.ToUpper()) && file.CreationTime > anyTimeAfter)
                              .FirstOrDefault().FullName;

            return(fileName);
        }
コード例 #5
0
        public void SelectEnvironment(string environmentValue)
        {
            int index = 0;

            for (; index < EnvironmentList.Options.Count; index++)
            {
                if (EnvironmentList.Options[index].Text.Trim() == environmentValue)
                {
                    break;
                }
            }
            EnvironmentList.SelectByIndex(index);
            Console.WriteLine("B2B environment selected is: ** {0} **", environmentValue);
            UtilityMethods.ClickElement(webDriver, GoButton);
        }
コード例 #6
0
        public void OpenCRTXML(string userId)
        {
            int count = 0;

            while (count < 4)
            {
                try
                {
                    UtilityMethods.ClickElement(webDriver, CRTResultTable.FindElement(By.XPath(string.Format("//td[text()='{0}']/..//a[text()='View Xml']", userId))));
                    break;
                }
                catch (StaleElementReferenceException e)
                {
                    Console.WriteLine("Trying to recover from a stale element :" + e.Message);
                    count = count + 1;
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Selects the status from the Status list
        /// </summary>
        /// <param name="Status[i]"></param>
        public void SelectTheStatus(string[] Status = null)
        {
            string stat           = string.Empty;
            var    statusDropDown = webDriver.FindElement(By.XPath("//div[@class='dropdown custom-select']/a[@class='dropdown-toggle']/span[contains(text(),'2 items selected ..')]"));

            UtilityMethods.ClickElement(webDriver, statusDropDown);
            foreach (string s in Status)
            {
                var elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                var catalogStatusInput = webDriver.FindElement(By.XPath("//input[@ng-model='statusSearch.CatalogStatus']"));
                if (s == "Created")
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.Created);
                    catalogStatusInput.Clear();
                    catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
                else if (s == "Created-Warning")
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.CreatedWarning);
                    catalogStatusInput.Clear();
                    catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
                else if (s == "Published")
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.Published);
                    catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
                else if (s == "Published-Warning")
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.PublishedWarning);
                    catalogStatusInput.Clear(); catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
                else if (s == "Expired")
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.Expired);
                    catalogStatusInput.Clear(); catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
                else if (s == "Created-Instant")
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.CreatedInstant);
                    catalogStatusInput.Clear(); catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
                else
                {
                    stat = UtilityMethods.ConvertToString <CatalogStatus>(CatalogStatus.CreatedWarningInstant);
                    catalogStatusInput.Clear(); catalogStatusInput.SendKeys(stat);
                    elem = webDriver.FindElement(By.XPath("//div[@class='dropdown-menu status']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']"));
                    if (!elem.Selected)
                    {
                        elem.Click();
                    }
                }
            }
            UtilityMethods.ClickElement(webDriver, statusDropDown);
        }