public void VerifyChoiceItemDisplay(ChoiceItem choice, bool expected) { ElementBase a = new ElementBase(string.Format("//*[contains(text(),'{0}')]", choice.Name), LocateBy.XPath); bool actual = a.IsDisplay; UIUtil.DefaultProvider.VerifyValue( expected, actual, string.Format("Verify display of choice item '{0}'", choice.Name)); }
public CustomFieldRow(CustomField field) { Label cfNameLabel = new Label(string.Format("//label[text()='{0}']", field.NameOnForm), LocateBy.XPath); field.Id = Convert.ToInt32(cfNameLabel.GetAttribute("for")); if (field is CFCheckBox) { CustomFieldType = new CheckBox(string.Format(locator + "//input", field.Id.ToString()), LocateBy.XPath); CustomFieldLabel = new Label(string.Format(locator + "//label", field.Id.ToString()), LocateBy.XPath); } }
public XAuth() { Test = new Clickable("ctl00_cphDialog_xAuth_btnTest", LocateBy.Id); OK = new Clickable("ctl00_cphDialog_saveForm", LocateBy.Id); ServiceEndpointURL = new Input("ctl00_cphDialog_xAuth_txtEndpointUrl", LocateBy.Id); MessageToRegistration = new Input("ctl00_cphDialog_xAuth_txtMessageToRegistrant", LocateBy.Id); TestEmail = new Input("ctl00_cphDialog_xAuth_txtTestEmailAddress", LocateBy.Id); TestUserName = new Input("ctl00_cphDialog_xAuth_txtTestUserName", LocateBy.Id); TestPassword = new Input("ctl00_cphDialog_xAuth_txtTestPassword", LocateBy.Id); DescriptionForIdentifer = new Input("ctl00_cphDialog_xAuth_txtLabel", LocateBy.Id); ForgetPasswordUrl = new Input("ctl00_cphDialog_xAuth_txtForgetPasswordUrl", LocateBy.Id); TestSuccessMessage = new Label("ctl00_cphDialog_xAuth_lblSuccessMessage", LocateBy.Id); ValidateMemberRequirePassword = new CheckBox("ctl00_cphDialog_xAuth_chkPassword", LocateBy.Id); ValidateMemberByUserName = new RadioButton("ctl00_cphDialog_xAuth_rdoMembership", LocateBy.Id); ValidateMemberByEmail = new RadioButton("ctl00_cphDialog_xAuth_rdoEmail", LocateBy.Id); ErrorDIVLocator = new ElementBase("//div[@id='ctl00_cphDialog_xAuth_xAuthValSummary']", LocateBy.XPath); }
public EventList_EventRow(int eventId) { this.EventId = eventId; this.Tr = new ElementBase( string.Format("//table[@id='ctl00_ctl00_cphDialog_cpMgrMain_rdgrdgrdForms_ctl00']/tbody/tr[@data-id='{0}']", eventId), LocateBy.XPath); string[] idAttribute = Tr.GetAttribute("id").Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); this.RowIndex = Convert.ToInt32(idAttribute[idAttribute.Length - 1]) + 1; this.Title = new Clickable( string.Format("{0}/td/a[@class='listEventTile']", this.Tr.Locator), LocateBy.XPath); this.Delete = new Clickable( string.Format("{0}/td/div[@class='actions']/a[@title='Delete event']", this.Tr.Locator), LocateBy.XPath); this.EventURL = new Clickable( string.Format("{0}/td//a[contains(@title,'regonline.com')]", this.Tr.Locator), LocateBy.XPath).GetAttribute("href"); }
public void SetGeneratedCodeHtml(DataCollection.HtmlButton button) { ElementBase TextArea_GeneratedCode = new ElementBase(string.Format("code_{0}", (int)button.Graphic_Type), UIUtility.LocateBy.Id); StringBuilder script = new StringBuilder(); script.Append(string.Format("var textArea_GeneratedCode = document.getElementById('{0}');", TextArea_GeneratedCode.Locator)); script.Append(string.Format("textArea_GeneratedCode.setAttribute('value', textArea_GeneratedCode.value);", TextArea_GeneratedCode.Locator)); UIUtility.UIUtil.DefaultProvider.ExecuteJavaScript(script.ToString()); button.CodeHtml = TextArea_GeneratedCode.GetAttribute("value"); }
public AgendaRow(AgendaItem agenda) { agenda.Id = this.GetAgendaItemId(agenda); this.AgendaLabel = this.GetAngedaLabel(agenda); switch (agenda.Type) { case FormData.CustomFieldType.AlwaysSelected: this.AgendaType = new CheckBox(agenda.Id.ToString(), LocateBy.Id); this.DiscountCodeInput = new Input("dc" + agenda.Id.ToString(), LocateBy.Id); this.GetAgendaDate(agenda); this.GetAgendaLocation(agenda); this.GetAgendaPrice(agenda); break; case FormData.CustomFieldType.CheckBox: this.AgendaType = new CheckBox(agenda.Id.ToString(), LocateBy.Id); this.DiscountCodeInput = new Input("dc" + agenda.Id.ToString(), LocateBy.Id); this.LimitFullMessage = new Label(string.Format("//li[@data-id='{0}']//div[@class='capacityMsg']", agenda.Id.ToString()), LocateBy.XPath); this.WaitlistMessage = new Label(string.Format("//li[@data-id='{0}']//span[@class='wlist']", agenda.Id.ToString()), LocateBy.XPath); this.Details = new Clickable(string.Format("//li[@data-id='{0}']//span/a[@href]", agenda.Id.ToString()), LocateBy.XPath); this.GetAgendaDate(agenda); this.GetAgendaLocation(agenda); this.GetAgendaPrice(agenda); break; case FormData.CustomFieldType.RadioButton: this.DiscountCodeInput = new Input("dc" + agenda.Id.ToString(), LocateBy.Id); this.GetAgendaDate(agenda); this.GetAgendaLocation(agenda); this.GetAgendaPrice(agenda); break; case FormData.CustomFieldType.Dropdown: this.AgendaType = new MultiChoiceDropdown(string.Format("//select[@id='{0}']", agenda.Id.ToString()), LocateBy.XPath); this.DiscountCodeInput = new Input("dc" + agenda.Id.ToString(), LocateBy.Id); this.GetAgendaDate(agenda); this.GetAgendaLocation(agenda); this.GetAgendaPrice(agenda); break; case FormData.CustomFieldType.Number: case FormData.CustomFieldType.OneLineText: case FormData.CustomFieldType.Contribution: case FormData.CustomFieldType.Paragraph: case FormData.CustomFieldType.Date: case FormData.CustomFieldType.Time: case FormData.CustomFieldType.Duration: this.AgendaType = new Input(agenda.Id.ToString(), LocateBy.Id); break; case FormData.CustomFieldType.FileUpload: this.AgendaType = new Clickable( string.Format("//li[@data-id='{0}']//a[@class='add_button']", agenda.Id.ToString()), LocateBy.XPath); this.GetAgendaLocation(agenda); this.GetAgendaPrice(agenda); break; case FormData.CustomFieldType.SectionHeader: break; case FormData.CustomFieldType.ContinueButton: this.AgendaType = new Clickable(string.Format("ctl00${0}", agenda.Id.ToString()), LocateBy.Name); break; default: break; } }
public static ElementBase GetAgendaLiElement(AgendaItem agenda) { ElementBase element_Li = null; switch (agenda.Type) { case FormData.CustomFieldType.OneLineText: case FormData.CustomFieldType.CheckBox: case FormData.CustomFieldType.Paragraph: case FormData.CustomFieldType.Date: case FormData.CustomFieldType.Time: case FormData.CustomFieldType.AlwaysSelected: case FormData.CustomFieldType.Contribution: case FormData.CustomFieldType.Number: case FormData.CustomFieldType.Dropdown: case FormData.CustomFieldType.Duration: element_Li = new ElementBase( string.Format("//div[@id='pageContent']//legend/following-sibling::ol/li[div[label[text()='{0}']]]", agenda.NameOnForm), LocateBy.XPath); if (agenda is AgendaItem_Common) { AgendaItem_Common a = agenda as AgendaItem_Common; if (a.SpacesAvailable.HasValue) { element_Li.Locator = string.Format( "//div[@id='pageContent']//legend/following-sibling::ol/li[div[label[starts-with(text(),'{0}')]]]", agenda.NameOnForm); } } break; case FormData.CustomFieldType.SectionHeader: element_Li = new ElementBase( string.Format("//div[@id='pageContent']//legend/following-sibling::ol/li[div[contains(text(),'{0}')]]", agenda.NameOnForm), LocateBy.XPath); break; case FormData.CustomFieldType.RadioButton: case FormData.CustomFieldType.FileUpload: case FormData.CustomFieldType.ContinueButton: element_Li = new ElementBase( string.Format("//div[@id='pageContent']//legend/following-sibling::ol/li[div[p[text()='{0}']]]", agenda.NameOnForm), LocateBy.XPath); break; default: break; } return element_Li; }
public static void VerifyDisplay(ElementBase element, bool isDisplayed) { bool actual = UIUtil.DefaultProvider.IsElementDisplay(element.Locator, element.TypeOfLocator); Utilities.VerifyTool.VerifyValue(isDisplayed, actual, "Element '" + element.Locator + "' is display: {0}"); }
public static bool IsElementPresent(ElementBase element) { return UIUtil.DefaultProvider.IsElementPresent(element.Locator, element.TypeOfLocator); }
public static void VerifyPresent(ElementBase element, bool isPresent) { bool actual = UIUtil.DefaultProvider.IsElementPresent(element.Locator, element.TypeOfLocator); Utilities.VerifyTool.VerifyValue(isPresent, actual, "Element '" + element.Locator + "' is present: {0}"); }