public UserProfileMacro(PageElement profileElement) { this.profileElement = profileElement; if (profileElement.find(By.className("vcard")).isPresent()) { PageElement usernameLink = profileElement.find(By.className("confluence-userlink")); PageElement emailLink = profileElement.find(By.className("email")); String username = usernameLink.getAttribute("data-username"); String fullName = usernameLink.getText(); String email = emailLink.isPresent() ? emailLink.getText() : ""; this.user = new KnownUser(null, username, fullName, (UserKey) null); this.status = profileElement.find(By.className("user-status")); } }
public PreviewPanel(PageElement pageElement) { PageElement descElement = pageElement.find(By.id("project-config-workflow-add-dialog-preview-desc")); this.description = descElement.isPresent() ? descElement.getText() : null; this.lastModifiedDate = pageElement.find(By.id("project-config-workflow-add-dialog-preview-last-modified-date")).getText(); PageElement lastModifiedUserElement = pageElement.find(By.id("project-config-workflow-add-dialog-preview-last-modified-user")); this.lastModifiedUser = lastModifiedUserElement.isPresent() ? lastModifiedUserElement.getText() : null; PageElement nameElement = pageElement.find(By.className("project-config-workflow-add-dialog-preview-name")); this.workflowName = nameElement.isPresent() ? nameElement.getText() : null; }
public ConfigureIssueTypeScreenSchemePage configure(final String issueTypeScreenSchemeName) { final PageElement configureLink = issueTypeScreenSchemesTable.find(By.cssSelector(format(CONFIGURE_LINK_CSS_SELECTOR, issueTypeScreenSchemeName))); assertTrue("Attempted to configure an issue type screen scheme that is not present on the page", configureLink.isPresent()); final String issueTypeScreenSchemeId = removeStart(configureLink.getAttribute("id"), "configure_issuetypescreenscheme_"); configureLink.click(); return pageBinder.bind(ConfigureIssueTypeScreenSchemePage.class, issueTypeScreenSchemeId); }
protected TimedQuery<String> toggleSearchMode(final NavigatorMode toMode) { final PageElement activeSwitcher = searchSwitcher.find(By.className("active")); if (!activeSwitcher.getAttribute("data-id").equals(toMode.toString())) { activeSwitcher.click(); } return searchSwitcher.find(By.className("active")).timed().getAttribute("data-id"); }
public WatchersComponent addWatcher(String watcher) { if (watcherWithSearch.isPresent()) { watchersMultiSelect.add(watcher); } else if (watchersNoSearch.isPresent()) { watchersNoSearch.type(watcher).type(Keys.ENTER); } waitUntilTrue(watchersDialog.find(By.cssSelector("li[data-username=" + watcher + "]")).timed().isPresent()); return this; }
private PageElement openIssueActionsMenu() { PageElement issueActionsTrigger = issue.find(By.className("issue-actions-trigger")); // HACK: Button appears on mouseover, which fails in webdriver, so use javascript to make element appear and be clickable issueActionsTrigger.javascript().execute("AJS.$(arguments[0]).addClass('active');"); Poller.waitUntilTrue("Issue actions trigger is not visible.", issueActionsTrigger.timed().isVisible()); issueActionsTrigger.click(); return finder.find(By.id("actions_" + id + "_drop")); } }
public ApplicationDetailsSection configureApplicationLink(String linkUrl) { waitUntilTrue(isApplinksListFullyLoaded()); PageElement row = elementFinder.find(By.id("ual-row-" + linkUrl)); if (!row.isPresent()) { throw new IllegalStateException("cannot configure app that doesn't exist:[" + linkUrl + "]"); } row.find(By.className("app-edit-link")).click(); waitUntilTrue(editApplicationLinkDialog.timed().isVisible()); return pageBinder.bind(ApplicationDetailsSection.class); }
public void submit() { dialogElement.find(By.className("app-role-defaults-dialog-submit-button")).click(); Poller.waitUntilFalse(dialogElement.withTimeout(TimeoutType.AJAX_ACTION).timed().isPresent()); }
/** * Wait until Insert File Dialog finish loading files. */ public void waitUntilLoadedFiles() { PageElement loadingElement = attachedImages.find(By.className("loading-message")); if (loadingElement.isPresent() && loadingElement.isVisible()) { Poller.waitUntilFalse(loadingElement.timed().isVisible()); } waitUntilTrue(panel.find(By.cssSelector("li.attached-file")).timed().isVisible()); } }
public void typeAndSetNewParentPage(final String newParentPage) { Poller.waitUntilTrue(newParentPageInput.timed().isVisible()); newParentPageInput.clear(); newParentPageInput.type(newParentPage); waitUntilTrue(newParentPageDropDown.timed().isVisible()); // Using WebDriver in Chrome, if there is an error message in the dialog, clicking on the dropdown won't work. We need to send keys to the // input field in order to select the space from the dropdown. WebElement newPageInputWebElement = driver.findElement(By.id(newParentPageInput.getAttribute("id"))); newPageInputWebElement.sendKeys(Keys.DOWN); newPageInputWebElement.sendKeys(Keys.ENTER); waitUntil(getBreadCrumbText(), containsString(newParentPage)); }
public PauseDialog clickContinueToCreateNonUalLink() throws Exception { Poller.waitUntilTrue(continueButton.timed().isVisible()); if ((createIncomingCheckBox.isPresent() && createIncomingCheckBox.isSelected())) { throw new Exception("For incoming links use clickContinueToCreateNonUalIncomingLink instead"); } continueButton.click(); Poller.waitUntilFalse(continueButton.timed().isVisible()); return pageBinder.bind(PauseDialog.class); }
public void removeTab() { deleteTab.click(); final DeleteTabDialog dialog = pageBinder.bind(DeleteTabDialog.class, deleteTab.getAttribute("data-tab")); dialog.submit(); Poller.waitUntilFalse(table.timed().isPresent()); }