private string ChooseType(Type selectType, int?index) { string newPrefix = Prefix + (index == null ? "" : ("_" + index)); Selenium.Wait(() => Popup.IsPopupVisible(Selenium, newPrefix) || Popup.IsPopupVisible(Selenium, Prefix), () => "Popup {0} or {1} to be visible".FormatWith(newPrefix, Prefix)); if (selectType == null) { if (ChooserPopup.IsChooser(Selenium, Prefix)) { throw new InvalidOperationException("TypeChooser found but arugment selectType is not specified"); } } else { if (ChooserPopup.IsChooser(Selenium, Prefix)) { ChooserPopup.ChooseButton(Selenium, Prefix, TypeLogic.GetCleanName(selectType)); Selenium.Wait(() => !ChooserPopup.IsChooser(Selenium, Prefix)); } } return(newPrefix); }
public PopupControl <T> CreateChoose <T>() where T : ModifiableEntity { Selenium.FindElement(CreateButtonLocator).Click(); //implementation popup opens Selenium.Wait(() => Popup.IsPopupVisible(Selenium, Prefix)); if (!ChooserPopup.IsChooser(Selenium, Prefix)) { throw new InvalidOperationException("{0} is not a Chooser".FormatWith(Selenium)); } ChooserPopup.ChooseButton(Selenium, Prefix, typeof(T)); return(new PopupControl <T>(Selenium, Prefix)); }