public AgendaReportRow(int agendaIndex) { Label AgendaFollowingTr = new Label(string.Format(agendaFollowingTr, agendaIndex), LocateBy.XPath); AgendaName = new Label(string.Format(agendaName, agendaIndex), LocateBy.XPath); for (int i = 1; i <= AgendaFollowingTr.Count; i++) { Label AttendeeFollowingTrIsAgenda = new Label(string.Format(attendeeFollowingTrIsAgenda, i), LocateBy.XPath); AttendeeRow attendeeRow = new AttendeeRow(); attendeeRow.CheckAttendee = new CheckBox(string.Format(attendeeTr, agendaIndex, i) + "/td[1]/input", LocateBy.XPath); attendeeRow.AttendeeId = new Clickable(string.Format(attendeeTr, agendaIndex, i) + "/td[2]/a", LocateBy.XPath); attendeeRow.AgendaStatus = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[3]", LocateBy.XPath); attendeeRow.AttendeeName = new Label(string.Format(attendeeTr,agendaIndex, i) + "/td[4]", LocateBy.XPath); attendeeRow.AttendeeCompany = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[5]", LocateBy.XPath); attendeeRow.AttendeeEmail = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[6]", LocateBy.XPath); attendeeRow.AttendeeWorkPhone = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[7]", LocateBy.XPath); attendeeRow.AttendeeHomePhone = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[8]", LocateBy.XPath); attendeeRow.AttendeeRegisterDate = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[9]", LocateBy.XPath); attendeeRow.AttendeeModifyDate = new Label(string.Format(attendeeTr, agendaIndex, i) + "/td[10]", LocateBy.XPath); Attendees.Add(attendeeRow); if (AttendeeFollowingTrIsAgenda.IsPresent) { break; } } }
private void GetOptions() { Label optionCount = new Label(Locator + "/option", LocateBy.XPath); for (int i = 1; i <= optionCount.Count; i++) { Label option = new Label(optionCount.Locator + "[" + i + "]", LocateBy.XPath); Options.Add(option); } }
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 List<Label> GetSelectedAgendaItems() { List<Label> agendaItems = new List<Label>(); Label agendaName = new Label("//fieldset[@class='registrantDetailSection'][legend[text()='Agenda']]//h4", LocateBy.XPath); for (int i = 1; i <= agendaName.Count; i++) { string agendaItemName = "//fieldset[@class='registrantDetailSection'][legend[text()='Agenda']]//h4[" + i.ToString() +"]"; agendaItems.Add(new Label(agendaItemName, LocateBy.XPath)); } return agendaItems; }
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 Input MerchInputField(DataCollection.MerchandiseItem merch) { Label merchNameLabel = new Label(string.Format("//label[text()='{0}']", merch.Name), LocateBy.XPath); merch.Id = Convert.ToInt32(merchNameLabel.GetAttribute("for")); return new Input(merch.Id.ToString(), LocateBy.Id); }
public AgendaRow(DataCollection.AgendaItem agendaItem) { Label agendaNameTd = new Label(string.Format("//span[@class='bold'][text()='{0}']/..", agendaItem.NameOnForm), LocateBy.XPath); string agendaNameOnclickAttriText = agendaNameTd.GetAttribute("onclick"); int agendaItemId = Convert.ToInt32(agendaNameOnclickAttriText.Split(new string[] { "'" }, StringSplitOptions.RemoveEmptyEntries)[1]); this.Agenda = new Clickable(string.Format("//*[@id='listGridTD{0}2']", agendaItemId), LocateBy.XPath); this.Delete = new Clickable(string.Format("//*[@id='listGridTD{0}5']//img[@title='Copy']/../../following-sibling::*//img", agendaItemId), LocateBy.XPath); this.Copy = new Clickable(string.Format("//*[@id='listGridTD{0}5']//img[@title='Copy']", agendaItemId), LocateBy.XPath); }
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 double? GetAgendaPrice(AgendaItem agenda) { Label price = new Label(string.Format("//li[@data-id='{0}']//div[@class='place'][span[text()='Price:']]", agenda.Id.ToString()), LocateBy.XPath); if (price.IsPresent) { string priceString = price.Text; string tmp = priceString.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); string PriceString = ""; for (int i = 0; i < tmp.Length; i++) { if (Char.IsNumber(tmp, i) || (tmp.Substring(i, 1) == ".")) { PriceString += tmp.Substring(i, 1); } } Price = Convert.ToDouble(PriceString); } return Price; }
public string GetAgendaLocation(AgendaItem agenda) { Label location = new Label(string.Format("//li[@data-id='{0}']//div[@class='place'][span[text()='Location:']]", agenda.Id.ToString()), LocateBy.XPath); if (location.IsPresent) { string locationString = location.Text; Location = locationString.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); } return Location; }
public DateTime? GetAgendaDate(AgendaItem agenda) { Label dateTime = new Label(string.Format("//li[@data-id='{0}']//div[@class='place'][span[text()='Date:']]", agenda.Id.ToString()), LocateBy.XPath); Label time = new Label(string.Format("//li[@data-id='{0}']//div[@class='place'][span[text()='Time:']]", agenda.Id.ToString()), LocateBy.XPath); if (time.IsPresent) { dateTime = time; } if (dateTime.IsPresent) { string dateTimeString = dateTime.Text; string tmp = null; if (!time.IsPresent) { tmp = dateTimeString.Split(new string[] { "te:" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); } else { tmp = dateTimeString.Split(new string[] { "me:" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); } if (tmp.Contains("-")) { string startDateTime = tmp.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0].Trim(); string endDateTimeTmp = tmp.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); string endDateTime = endDateTimeTmp.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries)[0].Trim(); StartDate = Convert.ToDateTime(startDateTime); EndDate = Convert.ToDateTime(endDateTime); } else { StartDate = EndDate = Convert.ToDateTime(tmp); } } return StartDate; }
public static bool IsTextPresent(string text) { Label label = new Label(string.Format("//*[contains(text(),'{0}')]", text), LocateBy.XPath); return label.IsPresent; }
public void PerformDefaultActions_Agenda(Registrant reg) { foreach (CustomFieldResponse responses in reg.CustomField_Responses) { if (responses is AgendaResponse) { AgendaResponse response = responses as AgendaResponse; switch (response.AgendaItem.Type) { case FormData.CustomFieldType.AlwaysSelected: { AgendaResponse_AlwaysSelected resp = response as AgendaResponse_AlwaysSelected; AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem); if (resp.Code != null) { row.DiscountCodeInput.Type(resp.Code.CodeString); } } break; case FormData.CustomFieldType.CheckBox: { AgendaResponse_Checkbox resp = response as AgendaResponse_Checkbox; AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem); ((CheckBox)row.AgendaType).Set(resp.Checked.Value); if (resp.Code != null) { row.DiscountCodeInput.Type(resp.Code.CodeString); } } break; case FormData.CustomFieldType.RadioButton: { AgendaResponse_MultipleChoice_RadioButton resp = response as AgendaResponse_MultipleChoice_RadioButton; Label choiceItemLabel = new Label(string.Format("//*[contains(text(),'{0}')]", resp.ChoiceItem.Name), LocateBy.XPath); resp.ChoiceItem.Id = Convert.ToInt32(choiceItemLabel.GetAttribute("for")); RadioButton radio = new RadioButton(resp.ChoiceItem.Id.ToString(), LocateBy.Id); radio.Click(); AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem); if (resp.Code != null) { row.DiscountCodeInput.Type(resp.Code.CodeString); } } break; case FormData.CustomFieldType.Dropdown: { AgendaResponse_MultipleChoice_DropDown resp = response as AgendaResponse_MultipleChoice_DropDown; AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem); ((MultiChoiceDropdown)row.AgendaType).SelectWithText(resp.ChoiceItem.Name); if (resp.Code != null) { row.DiscountCodeInput.Type(resp.Code.CodeString); } } break; case FormData.CustomFieldType.Number: case FormData.CustomFieldType.OneLineText: case FormData.CustomFieldType.Paragraph: { AgendaResponse_TextInput resp = response as AgendaResponse_TextInput; ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem( response.AgendaItem).AgendaType).Type(resp.CharToInput); } break; case FormData.CustomFieldType.Contribution: { AgendaResponse_Contribution resp = response as AgendaResponse_Contribution; ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem( response.AgendaItem).AgendaType).Type(resp.ContributionAmount); } break; case FormData.CustomFieldType.Date: { AgendaResponse_Date resp = response as AgendaResponse_Date; string date = string.Format("{0}/{1}/{2}", resp.Date.Value.Month, resp.Date.Value.Day, resp.Date.Value.Year); ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem( response.AgendaItem).AgendaType).Type(date); } break; case FormData.CustomFieldType.Time: { AgendaResponse_Time resp = response as AgendaResponse_Time; string time = string.Format("{0}:{1}", resp.Time.Value.Hour, resp.Time.Value.Minute); ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem( response.AgendaItem).AgendaType).Type(time); } break; case FormData.CustomFieldType.FileUpload: { AgendaResponse_FileUpload resp = response as AgendaResponse_FileUpload; ((Clickable)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem( response.AgendaItem).AgendaType).Click(); AutoIt.UploadFile.UploadAFile("File Upload", resp.FileSource); } break; case FormData.CustomFieldType.Duration: { AgendaResponse_Duration resp = response as AgendaResponse_Duration; ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem).AgendaType).Type(resp.Duration.ToString("c")); } break; default: throw new InvalidOperationException(string.Format("No action defined for specified type of agenda item: {0}", response.AgendaItem.Type.ToString())); } } } }
private void GetAgendaReportRows() { string agendaName = "//table[@id='rptParentTable']/tbody/tr[td/div[@class='section']]"; Label AgendaName = new Label(agendaName, LocateBy.XPath); for (int i = 1; i <= AgendaName.Count; i++) { AgendaReportRow agendaReportRow = new AgendaReportRow(i); AgendaReportRows.Add(agendaReportRow); } }