public void ClickAccessoryAddByProductName(string productName) { bool isFound = false; List <IWebElement> products = Driver.FindElements(BY_ACCESORIES_PRODUCT).ToList(); foreach (var product in products) { string productLabel = product.Text; if (stringEqualsIgnoreCase(productLabel, productName) || stringContainsIgnoreCase(productLabel, productName)) { isFound = true; IWebElement button = product.FindElement(BY_ACCESSORY_PRODUCT_CTA); DriverActions.ScrollToElement(button); DriverActions.clickElement(button); DriverActions.waitForAjaxRequestToComplete(); break; } } if (!isFound) { throw new NoSuchElementException(string.Format("Product with name {0} was not found for model {1}" , productName, Driver.Url)); } }
public void CollapseCategoryByName(string categoryName) { bool isFound = false; List <IWebElement> categories = Driver.FindElements(BY_BUILD_ACCESSORIES_CATEGORIES).ToList(); foreach (var category in categories) { if (stringEqualsIgnoreCase(categoryName, category.FindElement(BY_A_TAG_NAME).Text) || stringContainsIgnoreCase(categoryName, category.FindElement(BY_A_TAG_NAME).Text)) { isFound = true; DriverActions.ScrollToElement(category); DriverActions.clickElement(category); break; } } if (!isFound) { Assert.Fail("The category with name {0} is not present", categoryName); } }
public void ClickSubProductDetailsLinkByDesc(string productName) { bool isFound = false; List <IWebElement> products = Driver.FindElements(BY_PACKAGE_SUBPRODUCT_CARDS).ToList(); foreach (var product in products) { string productLabel = product.Text; if (stringEqualsIgnoreCase(productLabel, productName) || stringContainsIgnoreCase(productLabel, productName)) { isFound = true; IWebElement detailsLinks = product.FindElement(BY_SUBPRODUCT_DETAILS_LINK); DriverActions.ScrollToElement(detailsLinks); DriverActions.clickElement(detailsLinks); break; } } if (!isFound) { Assert.Fail("The product with name {0} is not present", productName); } }
public void ClickAccessoryAddByProductName(string productName) { bool isFound = false; List <IWebElement> products = Driver.FindElements(BY_BUILD_ACCESORIES_PRODUCTS).ToList(); foreach (var product in products) { string productLabel = product.FindElement(BY_LABEL_TAG_NAME).GetAttribute(HTML_INNER_ATTRIBUTE); if (stringEqualsIgnoreCase(productLabel, productName) || stringContainsIgnoreCase(productLabel, productName)) { isFound = true; IWebElement button = product.FindElement(BY_BUTTON_TAG_NAME); DriverActions.ScrollToElement(button); DriverActions.clickElement(button); break; } } if (!isFound) { Assert.Fail("The product with name {0} is not present", productName); } }
public void ClickAddPackageByDesc(string productName) { ExpandFactoryInstalledDropDownIfNeeded(); bool isFound = false; List <IWebElement> products = Driver.FindElements(BY_ACCESORIES_PRODUCT).ToList(); foreach (var product in products) { string productLabel = product.Text; if (stringEqualsIgnoreCase(productLabel, productName) || stringContainsIgnoreCase(productLabel, productName)) { isFound = true; IWebElement productCTA = product.FindElement(BY_CHILD_ADD_BUTTON); DriverActions.ScrollToElement(productCTA); DriverActions.clickElement(productCTA); break; } } if (!isFound) { Assert.Fail("The product with name {0} is not present", productName); } }
public void ClickProductDetailsLinkByDesc(string productName) { bool isFound = false; List <IWebElement> products = Driver.FindElements(BY_ACCESORIES_PRODUCT).ToList(); foreach (var product in products) { string productLabel = product.Text; if (stringEqualsIgnoreCase(productLabel, productName) || stringContainsIgnoreCase(productLabel, productName)) { isFound = true; IWebElement detailsLinks = product.FindElement(BY_PRODUCT_DETAILS_LINK); DriverActions.ScrollToElement(detailsLinks); DriverActions.clickElement(detailsLinks); break; } } if (!isFound) { throw new NoSuchElementException(string.Format("Product with name {0} was not found for model {1}", productName, Driver.Url)); } }