public AbsPage zPressButton(Button button) throws HarnessException { logger.info(myPageName() + " zDisplayPressButton(" + button + ")"); tracer.trace("Click " + button); AbsPage page = this; String locator = null; boolean doPostfixCheck = false; if (button == Button.B_VIEW_ENTIRE_MESSAGE) { locator = this.ContainerLocator + " span[id$='_msgTruncation_link']"; if (!this.sIsElementPresent(locator)) throw new HarnessException("locator is not present for button " + button + " : " + locator); this.sClick(locator); // sClick() is required for this element this.zWaitForBusyOverlay(); return (page); } else if (button == Button.B_HIGHLIGHT_OBJECTS) { locator = this.ContainerLocator + " span[id$='_highlightObjects_link']"; if (!this.sIsElementPresent(locator)) throw new HarnessException("locator is not present for button " + button + " : " + locator); this.sClick(locator); // sClick() is required for this element this.zWaitForBusyOverlay(); return (page); } else if (button == Button.B_ACCEPT) { locator = DisplayMail.Locators.AcceptButton; page = null; doPostfixCheck = true; } else if (button == Button.O_ACCEPT_NOTIFY_ORGANIZER) { locator = DisplayMail.Locators.AcceptNotifyOrganizerMenu; page = null; doPostfixCheck = true; } else if (button == Button.O_ACCEPT_EDIT_REPLY) { locator = DisplayMail.Locators.AcceptEditReplyMenu; page = null; doPostfixCheck = true; } else if (button == Button.O_ACCEPT_DONT_NOTIFY_ORGANIZER) { locator = DisplayMail.Locators.AcceptDontNotifyOrganizerMenu; page = null; doPostfixCheck = true; } else if (button == Button.B_TENTATIVE) { locator = DisplayMail.Locators.TentativeButton; page = null; doPostfixCheck = true; } else if (button == Button.O_TENTATIVE_NOTIFY_ORGANIZER) { locator = DisplayMail.Locators.TentativeNotifyOrganizerMenu; page = null; doPostfixCheck = true; } else if (button == Button.O_TENTATIVE_EDIT_REPLY) { locator = DisplayMail.Locators.TentativeEditReplyMenu; page = null; doPostfixCheck = true; } else if (button == Button.O_TENTATIVE_DONT_NOTIFY_ORGANIZER) { locator = DisplayMail.Locators.TentativeDontNotifyOrganizerMenu; page = null; doPostfixCheck = true; } else if (button == Button.B_DECLINE) { locator = DisplayMail.Locators.DeclineButton; page = null; doPostfixCheck = true; } else if (button == Button.O_DECLINE_NOTIFY_ORGANIZER) { locator = DisplayMail.Locators.DeclineNotifyOrganizerMenu; page = null; doPostfixCheck = true; } else if (button == Button.O_DECLINE_EDIT_REPLY) { locator = DisplayMail.Locators.DeclineEditReplyMenu; page = null; doPostfixCheck = true; } else if (button == Button.O_DECLINE_DONT_NOTIFY_ORGANIZER) { locator = DisplayMail.Locators.DeclineDontNotifyOrganizerMenu; page = null; doPostfixCheck = true; } else if (button == Button.B_PROPOSE_NEW_TIME) { locator = DisplayMail.Locators.ProposeNewTimeButton; page = null; } else if (button == Button.B_ACCEPT_SHARE) { locator = this.ContainerLocator + " td[id$='__Shr__SHARE_ACCEPT_title']"; page = new SeparateWindowDialog(DialogWarningID.ZmAcceptShare, MyApplication, this); ((SeparateWindowDialog) page).zSetWindowTitle(this.DialogWindowTitle); doPostfixCheck = true; } else if (button == Button.B_DECLINE_SHARE) { locator = this.ContainerLocator + " td[id$='__Shr__SHARE_DECLINE_title']"; page = new SeparateWindowDialog(DialogWarningID.ZmAcceptShare, MyApplication, this); ((SeparateWindowDialog) page).zSetWindowTitle(this.DialogWindowTitle); doPostfixCheck = true; } else { throw new HarnessException("no implementation for button: " + button); } if (locator == null) throw new HarnessException("no locator defined for button " + button); if (!this.sIsElementPresent(locator)) throw new HarnessException("locator is not present for button " + button + " : " + locator); this.zClick(locator); this.zWaitForBusyOverlay(); if (page != null) { page.zWaitForActive(); } if (doPostfixCheck) { // Make sure the response is delivered before proceeding Stafpostqueue sp = new Stafpostqueue(); sp.waitForPostqueue(); } return (page); }
@Override public AbsPage zClickButton(Button button) throws HarnessException { logger.info(myPageName() + " zClickButton(" + button + ")"); tracer.trace("Click dialog button " + button); if (button == null) throw new HarnessException("button cannot be null"); String locator = null; AbsPage page = null; boolean waitForPostfix = false; if (button == Button.B_SEARCH_LOCATION) { locator = Locators.LocationPickerSerach; page = null; } else if (button == Button.B_SELECT_LOCATION) { locator = Locators.SelectLocationFromPicker; page = null; } else if (button == Button.B_OK) { locator = Locators.AddLocationFromPicker; page = null; } else if (button == Button.B_CANCEL) { locator = "css=div[class='DwtDialog'] td[id$='_button1_title']"; page = null; } else { return (super.zClickButton(button)); } // Make sure the locator was set if (locator == null) { throw new HarnessException("Button " + button + " not implemented"); } // Make sure the locator exists if (!this.sIsElementPresent(locator)) { throw new HarnessException("Button " + button + " locator " + locator + " not present!"); } this.sFocus(locator); this.sGetCssCount(locator); this.sClickAt(locator, ""); this.zWaitForBusyOverlay(); SleepUtil.sleepMedium(); // If page was specified, make sure it is active if (page != null) { // This function (default) throws an exception if never active page.zWaitForActive(); } // This dialog could send messages, so wait for the queue if (waitForPostfix) { Stafpostqueue sp = new Stafpostqueue(); sp.waitForPostqueue(); } return (page); }