public DriverEnterPage ValidateOptionDisplayedInLicenseStateDropdown(string option) { var node = GetLastNode(); try { LicenseStateDropdown.Click(); WaitForElementVisible(_eleDropdownOptions); string[] optionList = DropdownOptionsLabel.Select(x => x.Text).ToArray(); string actualOptionsList = string.Join(" - ", optionList); if (optionList.Contains(option)) { SetPassValidation(node, string.Format(ValidationMessage.ValidateOptionDisplayedInLicenseStateDropdown, option), actualOptionsList); } else { SetFailValidation(node, string.Format(ValidationMessage.ValidateOptionDisplayedInLicenseStateDropdown, option), actualOptionsList); } LicenseStateDropdown.SendKeys(Keys.Tab); WaitForElementInvisible(_eleDropdownOptions); } catch (Exception e) { SetErrorValidation(node, string.Format(ValidationMessage.ValidateOptionDisplayedInLicenseStateDropdown, option), e); } return(this); }
public DriverEnterPage ValidateLicenseStateDisplayedInAlphabeticalWithoutSpecifiedStateAtBottom(string specifiedState) { var node = GetLastNode(); bool result = true; LicenseStateDropdown.Click(); WaitForElementVisible(_eleDropdownOptions); string[] licenseStateList = DropdownOptionsLabel.Select(x => x.Text).ToArray(); string actualStateList = string.Join(" - ", licenseStateList); try { if (licenseStateList[licenseStateList.Length - 1] == specifiedState) { result = false; } else { for (int i = 0; i < licenseStateList.Length - 1; i++) { if (licenseStateList[i].Length != 2 || StringComparer.Ordinal.Compare(licenseStateList[i][0], licenseStateList[i + 1][0]) > 0) { result = false; break; } } } if (result) { SetPassValidation(node, string.Format(ValidationMessage.ValidateLicenseStateDisplayedInAlphabeticalWithoutSpecifiedStateAtBottom, specifiedState), actualStateList); } else { SetFailValidation(node, string.Format(ValidationMessage.ValidateLicenseStateDisplayedInAlphabeticalWithoutSpecifiedStateAtBottom, specifiedState), actualStateList); } LicenseStateDropdown.SendKeys(Keys.Tab); WaitForElementInvisible(_eleDropdownOptions); } catch (Exception e) { SetErrorValidation(node, string.Format(ValidationMessage.ValidateLicenseStateDisplayedInAlphabeticalWithoutSpecifiedStateAtBottom, specifiedState), e); } return(this); }