public void ClickRandomModelVersion() { List <IWebElement> modelVersions = Driver.FindElements(BY_MODELS_CARDS).ToList(); int randomModel = rnd.Next(0, modelVersions.Count - 1); DriverActions.clickElement(modelVersions[randomModel]); }
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 RemoveAccessoryFromSummaryByDesc(string description) { bool isFound = false; List <IWebElement> accessories = Driver.FindElements(BY_BUILD_SUMMARY_ACCESORIES).ToList(); foreach (var item in accessories) { string desc = item.FindElement(BY_PRP_SECONDARY_PART_DESC).Text; if (stringContainsIgnoreCase(desc, description)) { IWebElement remove = item.FindElement(BY_BUILD_SUMMARY_REMOVE_LINK); DriverActions.clickElement(remove); isFound = true; break; } else { isFound = false; } } if (!isFound) { Assert.Fail("Accessory passed {0} is not present on the build summary", description); } }
public void ClickRandomWholegoodEngine() { List <IWebElement> wholegoodColors = Driver.FindElements(BY_WHOLEGOOD_ENGINE).ToList(); int randomColor = rnd.Next(0, wholegoodColors.Count); DriverActions.clickElement(wholegoodColors[randomColor]); }
public void ClickAcctLoggedInIcon() { DriverActions.waitForAjaxRequestToComplete(); WebDriverExtensions.WaitForPageLoaded(Driver); DriverActions.WaitForCanvassToComplete(); DriverActions.waitForElementVisibleAndEnabled(BY_ACCT_LOGGED_IN_ICON); DriverActions.clickElement(BY_ACCT_LOGGED_IN_ICON); }
public void ClickKitPackageDropdownArrow() { List <IWebElement> kitPackageArrows = Driver.FindElements(BY_KIT_PACKAGE_ICON_ARROW).ToList(); foreach (var item in kitPackageArrows) { DriverActions.clickElement(item); } }
public void ClickFooterNextButton() { if (IsWidgetContainerDisplayed()) { DriverActions.clickElement(BY_FOOTER_WIDGET_CARET); } DriverActions.waitForElementVisibleAndEnabled(BY_FOOTER_NEXT_BUTTON); DriverActions.clickElement(BY_FOOTER_NEXT_BUTTON); }
public void ExpandFactoryInstalledDropDownIfNeeded() { IWebElement factoryInstalledDropDown = Driver.FindElement(BY_FACTORY_INSTALLED_DROPDOWN); string sym = GetSymbolValue(factoryInstalledDropDown); if (stringContainsIgnoreCase(sym, PLUS)) { DriverActions.clickElement(factoryInstalledDropDown); } }
public void ClickFooterNextButtonOpenSummary() { if (DriverActions.IsElementPresent(BY_FOOTER_NEXT_BUTTON)) { DriverActions.clickElement(BY_FOOTER_NEXT_BUTTON); } else { OpenBuildSummary(); } }
public void ClickRemoveLinkPRP() { try { DriverActions.clickElement(By_REMOVE_LINK_PRP); } catch (Exception) { DriverActions.clickElement(By_REMOVE_LINK_OLD_PRP); } }
public void ClickCategoryAndVerifyModelsAreNotDuplicate() { int categories = GetCategoryWholegoodCards().Count; Assert.Greater(categories, 0, "Wholegood cards collection is null"); for (int i = 0; i < categories; i++) { DriverActions.clickElement(GetCategoryWholegoodCards()[i]); Assert.IsTrue(VerifyModelsAreNotDuplicates()); GoToPreviousPage(); WaitForCategoryPageToLoad(); } }
public bool VerifyDataPresentForSubCategories() { bool isDataPresent = false; List <IWebElement> categories = Driver.FindElements(BY_BUILD_CATEGORIES).ToList(); foreach (var category in categories) { isDataPresent = false; DriverActions.clickElement(category); List <IWebElement> subCategories = Driver.FindElements(BY_SUBCATEGORY_OPTIONS).ToList(); isDataPresent = subCategories.Count > 0 ? true : false; } return(isDataPresent); }
public void ClickEachModelAndVerifyTrimsAreNotDuplicate() { int categories = BuildModelPage.GetWholegoodsModelsCards().Count; Assert.Greater(categories, 0, "Wholegood cards collection is null"); for (int i = 0; i < categories; i++) { DriverActions.clickElement(BuildModelPage.GetWholegoodsModelsCards()[i]); Assert.IsTrue(VerifyTrimsAreNotDuplicates()); GoToPreviousPage(); BuildModelPage.WaitForBuildModelPageToLoad(); } }
public void ClickRandomSubstepInput() { List<IWebElement> substeps = Driver.FindElements(BY_SUBSTEP_INPUT).ToList(); List<IWebElement> enabledSubsteps = new List<IWebElement>(); foreach (var item in substeps) { if (DriverActions.IsElementPresent(item)) { enabledSubsteps.Add(item); } } int randomInput = rnd.Next(0, enabledSubsteps.Count); DriverActions.clickElement(enabledSubsteps[randomInput]); DriverActions.waitForAjaxRequestToComplete(); }
public void HandlePurposePromptModal() { try { if (DriverActions.IsElementPresent(BY_PURPOSE_PROMPT_MODAL)) { DriverActions.clickElement(BY_ICON_FOR_FUN); DriverActions.waitForAjaxRequestToComplete(); DriverActions.clickElement(BY_PURPOSE_PROMPT_BUILD_BUTTON); DriverActions.waitForAjaxRequestToComplete(); } } catch (Exception) { } }
public void ClickPrpSecondaryPartSelectByDesc(string productDesc) { List <IWebElement> secondaryParts = Driver.FindElements(BY_PRP_SECONDARY_PARTS).ToList(); foreach (var part in secondaryParts) { string productString = part.FindElement(BY_PRP_SECONDARY_PART_DESC).Text; //string product = productString.Substring(productString.LastIndexOf("#") + 1); if (stringEqualsIgnoreCase(productString, productDesc) || stringContainsIgnoreCase(productString, productDesc)) { IWebElement select = part.FindElement(BY_PRP_SECONDARY_SELECT_CHILD); DriverActions.clickElement(select); break; } } }
public bool ClickOptionHeadingByName(string option) { bool isFound = false; List<IWebElement> headings = Driver.FindElements(BY_SUBSTEP_OPTIONS).ToList(); foreach (var item in headings) { string headingTxt = item.FindElement(BY_OPTION_HEADING).Text; if (stringContainsIgnoreCase(headingTxt, option)) { isFound = true; DriverActions.clickElement(item); break; } } return isFound; }
public bool ClickSubstepOptionByTitle(string optionName) { bool isFound = false; List<IWebElement> substepOptions = Driver.FindElements(BY_SUBSTEP_OPTIONS_LIST).ToList(); foreach (var item in substepOptions) { string substepOption = item.FindElement(SPAN_TAG_NAME).Text; if (substepOption.Length > 0 && stringContainsIgnoreCase(substepOption, optionName)) { isFound = true; DriverActions.clickElement(item); break; } } return isFound; }
public void ClickPackageByName(string package) { bool isFound = false; List <IWebElement> packages = Driver.FindElements(BY_PACKAGE_NAMES).ToList(); foreach (var item in packages) { string packageText = item.Text; if (stringEqualsIgnoreCase(packageText, package) || stringContainsIgnoreCase(packageText, package)) { isFound = true; DriverActions.clickElement(item); break; } } if (!isFound) { Assert.Fail("The package with name {0} is not present", package); } }
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 ClickSubcategoryByName(string subCategoryName) { bool isFound = false; List <IWebElement> subCategories = Driver.FindElements(BY_ACCESSORY_SUBCATEGORY).ToList(); foreach (var subCategory in subCategories) { string subcategoryText = subCategory.FindElement(BY_BUTTON_TAG_NAME).Text.Trim(); if ((subcategoryText.Length != 0) && (stringEqualsIgnoreCase(subcategoryText, subCategoryName) || stringContainsIgnoreCase(subcategoryText, subCategoryName))) { isFound = true; DriverActions.clickElement(subCategory); break; } } if (!isFound) { Assert.Fail("The sub category with name {0} is not present", subCategoryName); } }
public void ClickConflictingItemRemoveByDesc(string description) { bool isFound = false; List <IWebElement> items = Driver.FindElements(BY_CONFLICT_ITEMS).ToList(); foreach (var item in items) { string itemDesc = item.FindElement(BY_PRP_SECONDARY_PART_DESC).Text; if (itemDesc.Length > 0 && stringContainsIgnoreCase(itemDesc, description)) { IWebElement remove = item.FindElement(BY_PRP_SECONDARY_SELECT_CHILD); DriverActions.clickElement(remove); isFound = true; break; } } if (!isFound) { Assert.Fail("Accessory passed {0} is not present on the conflict container", description); } }
public void ClickSeeDetailsLinkByProductName(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 link = product.FindElement(BY_BUILD_ACCEOSSORIES_PRODUCT_DETAILS); DriverActions.clickElement(link); break; } } if (!isFound) { Assert.Fail("The product with name {0} is not present", productName); } }
public void ClickSubcategoryByName(string subCategoryName) { bool isFound = false; List <IWebElement> subCategories = Driver.FindElements(BY_SUBCATEGORY_TITLE).ToList(); foreach (var subCategory in subCategories) { string subcategoryText = subCategory.Text; if ((subcategoryText.Length != 0) && (stringEqualsIgnoreCase(subcategoryText, subCategoryName) || stringContainsIgnoreCase(subcategoryText, subCategoryName))) { isFound = true; DriverActions.clickElement(subCategory); DriverActions.waitForAjaxRequestToComplete(); break; } } if (!isFound) { throw new NoSuchElementException(string.Format("Sub category with name {0} was not found for model {1}" , subCategoryName, Driver.Url)); } }
public void ClickCategoryByName(string categoryName) { bool isFound = false; List <IWebElement> categories = Driver.FindElements(BY_ACCESSORIES_CATEGORIES).ToList(); foreach (var category in categories) { string categoryText = category.FindElement(BY_BUTTON_TAG_NAME).Text; if (stringEqualsIgnoreCase(categoryText, categoryName) || stringContainsIgnoreCase(categoryText, categoryName)) { isFound = true; DriverActions.clickElement(category); DriverActions.waitForAjaxRequestToComplete(); break; } } if (!isFound) { throw new NoSuchElementException(string.Format("Category with name {0} was not found for model {1}" , categoryName, Driver.Url)); } }
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 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)); } }
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 ClickDropDownAcctIcon() { DriverActions.clickElement(BY_DROPDOWN_ACCT_ICON); }
public void ClickAcctModalLogOut() { DriverActions.clickElement(BY_ACCT_MODAL_LOG_OUT); }