List of usage examples for org.openqa.selenium WebElement isEnabled
boolean isEnabled();
From source file:org.alfresco.po.share.site.links.LinkComment.java
License:Open Source License
public boolean isCorrect() { try {//from www . j a v a 2s . c o m focusOn(); WebElement text = findAndWait(TEXT); WebElement editBtn = findAndWait(EDIT_BUTTON); WebElement deleteBtn = findAndWait(DELETE_BUTTON); boolean isCorrect = editBtn.isDisplayed() && editBtn.isEnabled(); isCorrect = isCorrect && deleteBtn.isDisplayed() && deleteBtn.isDisplayed(); isCorrect = isCorrect && text.isDisplayed(); return isCorrect; } catch (Exception e) { logger.error("LinkComment don't correct."); return false; } }
From source file:org.alfresco.po.share.site.UploadFilePage.java
License:Open Source License
/** * Clicks on the cancel link.// w w w . j ava 2 s . c o m */ public void cancel() { List<WebElement> cancelButton = driver .findElements(By.cssSelector("button[id$='default-cancelOk-button-button']")); for (WebElement webElement : cancelButton) { if (webElement.isDisplayed() && webElement.isEnabled()) { webElement.click(); } } }
From source file:org.alfresco.po.share.site.wiki.WikiPage.java
License:Open Source License
/** * click on save button to save wiki text. *//*www. j a v a2 s. co m*/ public WikiPage clickSaveButton() { try { waitUntilElementClickable(BUTTON_SAVE, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); WebElement saveButton = findAndWait(BUTTON_SAVE); if (saveButton.isEnabled()) { saveButton.click(); waitUntilElementDeletedFromDom(DEFAULT_CONTENT_TOOLBAR, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } else { throw new PageException(BUTTON_SAVE + " is not enabled"); } return getCurrentPage().render(); } catch (TimeoutException toe) { throw new PageException("Not able find the Save Button"); } }
From source file:org.alfresco.po.share.util.PageUtils.java
License:Open Source License
/** * Is a WebElement usable?/*from w w w . j a v a 2s.c o m*/ * * @param element the WebElement * @return boolean */ public static boolean usableElement(WebElement element) { if (element != null && element.isDisplayed() && element.isEnabled() && !StringUtils.contains(element.getAttribute("class"), "dijitDisabled") && !StringUtils.contains(element.getAttribute("aria-disabled"), "true")) { return true; } return false; }
From source file:org.alfresco.po.share.workflow.DestinationAndAssigneePage.java
License:Open Source License
/** * This method accepts string array of//www . j a v a 2s . c o m * folders. * <br> * ForMultiLevelFolder folder, subFolder, superSubFolder... * <br> * FotSingleLevelFolder folder. * @param folderPath String... */ public void selectFolder(String... folderPath) { if (folderPath == null || folderPath.length < 1) { throw new IllegalArgumentException("Invalid Folder path!!"); } for (String folder : folderPath) { List<WebElement> folderNames = getFoldersList(); for (WebElement syncFolder : folderNames) { if (syncFolder.getText().equals(folder)) { if (!syncFolder.isEnabled()) { throw new PageOperationException("Sync Folder is disabled"); } syncFolder.click(); if (logger.isTraceEnabled()) { logger.trace("Folder \"" + folder + "\" selected"); } if (folderPath.length > 1) { // waitUntilElementDeletedFromDom(By.cssSelector("div[id$='default-cloud-folder-treeview'] td[class='ygtvcell ygtvloading']"), // SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); // waitForElement(By.cssSelector("div[id$='default-cloud-folder-treeview'] td[class^='ygtvcell']>a.ygtvspacer"), // SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); try { waitForElement(By.id("AlfrescoWebdriverz1"), SECONDS.convert(getDefaultWaitTime(), MILLISECONDS)); } catch (TimeoutException e) { } // driver.waitFor(FOLDER_LOAD_TIME); } break; } } } }
From source file:org.alfresco.po.share.workflow.DestinationAndAssigneePage.java
License:Open Source License
/** * Click on submit button to submit sync properties. * //from w w w. j a va 2s. co m * @return HtmlPage */ public HtmlPage selectSubmitButtonToSync() { try { WebElement syncButton = findAndWait(SUBMIT_SYNC_BUTTON); if (!syncButton.isEnabled()) { throw new PageOperationException("Sync Button is disabled"); } String saveButtonId = syncButton.getAttribute("id"); syncButton.click(); waitUntilElementDisappears(By.id(saveButtonId), SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); if (!driver.getCurrentUrl().contains("workflow")) { waitUntilElementPresent(By.cssSelector("div#message>div.bd>span"), SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); waitUntilElementDeletedFromDom(By.cssSelector("div#message>div.bd>span"), SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } return getCurrentPage(); } catch (TimeoutException toe) { logger.error("Submit button not found!!", toe); } throw new PageException(); }
From source file:org.alfresco.po.share.workflow.SelectContentPage.java
License:Open Source License
/** * Method to verify Folder Up button is Enabled or not * /* w w w . j av a 2s .c om*/ * @return True if enabled */ public boolean isFolderUpButtonEnabled() { try { List<String> elements = getDirectoriesLeftPanel(); if (!elements.isEmpty()) ; { WebElement webElement = findAndWait(folderUpButton); boolean isUp = webElement.isEnabled(); return isUp; } } catch (NoSuchElementException nse) { throw new PageOperationException("Unable to find \"Folder Up\" button", nse); } }
From source file:org.aludratest.service.gui.web.selenium.selenium2.condition.ElementClickable.java
License:Apache License
/** Provides the evaluation logic as static public method. * @param element the element to check//ww w . j ava 2 s .com * @return true if the element is clickable, otherwise false */ public static boolean isClickable(WebElement element) { if (!element.isEnabled()) { return false; } String tagName = element.getTagName().toLowerCase(); if (!EDITABLE_ELEMENTS.contains(tagName)) { return false; } if ("input".equals(tagName) && "true".equals(element.getAttribute("readonly"))) { return false; } return true; }
From source file:org.aludratest.service.gui.web.selenium.selenium2.condition.ElementEnabledCondition.java
License:Apache License
@Override protected WebElement applyOnElement(WebElement element) { if (enabled && !element.isEnabled()) { this.message = "Element not enabled"; return null; }/*from ww w .jav a2s .c o m*/ if (!enabled && element.isEnabled()) { this.message = "Element enabled"; return null; } return element; }
From source file:org.aludratest.service.gui.web.selenium.selenium2.condition.MixedElementCondition.java
License:Apache License
@Override protected WebElement applyOnElement(WebElement element) { // check if it is in foreground if (zIndexSupport != null && !zIndexSupport.isInForeground(element)) { this.message = "Element not in foreground"; return null; }//from w w w. j a va 2 s. co m // check visibility if required if (visible && !element.isDisplayed()) { // try to scroll to element try { Actions actions = new Actions(locatorSupport.getDriver()); actions.moveToElement(LocatorSupport.unwrap(element)).perform(); } catch (Throwable t) { // ignore } if (!element.isDisplayed()) { this.message = "Element not visible"; return null; } } if (enabled && !element.isEnabled()) { this.message = "Element not enabled"; return null; } return element; }