/// <summary> /// Selects the country from the country listed /// if not specified, selects the first country from the drop down /// </summary> /// <param name="identity"></param> public void SelectTheCountry(string country = "") { if (country == "UK") { country = UtilityMethods.ConvertToString <CountryName>(CountryName.UK); } else if (country == "US") { country = UtilityMethods.ConvertToString <CountryName>(CountryName.US); } else if (country == "CA") { country = UtilityMethods.ConvertToString <CountryName>(CountryName.CA); } else if (country == "FR") { country = UtilityMethods.ConvertToString <CountryName>(CountryName.FR); } else if (country == "DE") { country = UtilityMethods.ConvertToString <CountryName>(CountryName.DE); } else if (country == "NL") { country = UtilityMethods.ConvertToString <CountryName>(CountryName.NL); } webDriver.FindElement(By.XPath("//div[@class='dropdown custom-select']/a")).Click(); webDriver.FindElement(By.XPath("//input[@ng-model='search.Name']")).SendKeys(country); webDriver.FindElement(By.XPath("//div[@class='dropdown-menu countries']//ul[@role='menu']/li[@class='ng-binding ng-scope']/input[@ng-model='checked']")).Click(); }
/// <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); }