List of usage examples for org.openqa.selenium WebElement isEnabled
boolean isEnabled();
From source file:net.atf4j.webdriver.page.AbstractPageObject.java
License:Open Source License
/** * Verify./*from w ww .jav a2s . com*/ * * @param webElement the web element \* @return true, if successful, * otherwise false. * @return true, if successful, otherwise false. */ protected boolean verifyElement(final WebElement webElement) { verifyNotNull(webElement); final boolean testStatus = true; verifyNotNull(webElement); verifyNotNull(webElement.toString()); assertTrue(webElement.isDisplayed()); assertTrue(webElement.isEnabled()); return testStatus; }
From source file:net.codestory.simplelenium.filters.LazyShould.java
License:Apache License
private static String enabledStatus(WebElement element) { return element.isEnabled() ? "enabled" : "not enabled"; }
From source file:omelet.common.ExpectedConditionExtended.java
License:Apache License
/*** * wait for the WebElement to be Clickable * /*from ww w. j a v a2 s. c o m*/ * @param element * : WebElement * @return */ public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement element) { return new ExpectedCondition<WebElement>() { public WebElement apply(WebDriver driver) { try { if (element.isDisplayed() && element.isEnabled()) { return element; } else { return null; } } catch (StaleElementReferenceException e) { LOGGER.error(e); return null; } catch (NoSuchElementException e) { LOGGER.error(e); return null; } } @Override public String toString() { return "Element is not enabled"; } }; }
From source file:omelet.common.ExpectedConditionExtended.java
License:Apache License
/*** * wait for the Element to be Disabled// w w w . java 2s . c om * * @param element * @return */ public static ExpectedCondition<Boolean> elementToBeDisabled(final WebElement element) { return new ExpectedCondition<Boolean>() { public ExpectedCondition<WebElement> visibilityOfElement = ExpectedConditions.visibilityOf(element); public Boolean apply(WebDriver driver) { boolean isDisabled = false; WebElement element = visibilityOfElement.apply(driver); try { if (element != null && !(element.isEnabled())) { isDisabled = true; } return isDisabled; } catch (StaleElementReferenceException e) { // TODO check if error, debug or warn LOGGER.warn("Element not found: " + element.toString()); return isDisabled; } } @Override public String toString() { return "element to be clickable: " + element; } }; }
From source file:omelet.common.ExpectedConditionExtended.java
License:Apache License
/*** * This method accepts n number of WebElements and check for click ability * if any of the WebElement is not click able will return false * // w ww.java 2s .c o m * @param elements * @return */ public static ExpectedCondition<Boolean> elementsToBeClickable(final WebElement... elements) { final List<Boolean> statusList = new ArrayList<Boolean>(); return new ExpectedCondition<Boolean>() { final StringBuilder sb = new StringBuilder(); public Boolean apply(WebDriver driver) { for (WebElement w : elements) { try { if (w.isDisplayed() && w.isEnabled()) { statusList.add(true); } else { statusList.add(false); } } catch (StaleElementReferenceException e) { LOGGER.error(e); statusList.add(false); } } if (statusList.contains(false)) { statusList.clear(); return false; } return true; } @Override public String toString() { return "elements to be clickable: " + sb; } }; }
From source file:omelet.common.ExpectedConditionExtended.java
License:Apache License
/*** * Check clikability for the list of WebElement * /*from w w w . jav a 2s. c om*/ * @param elements * @return */ public static ExpectedCondition<Boolean> elementToBeClickable(final List<WebElement> elements) { final List<Boolean> statusList = new ArrayList<Boolean>(); return new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { if (elements.isEmpty()) { return false; } statusList.clear(); for (WebElement w : elements) { try { if (w != null && w.isEnabled() && w.isDisplayed()) { statusList.add(true); } else { return false; } } catch (StaleElementReferenceException e) { LOGGER.error(e); return false; } } LOGGER.debug( "element size is:" + elements.size() + " and is sucesfull list is:" + statusList.size()); return statusList.size() == elements.size() ? true : false; } @Override public String toString() { return "One of the Element is not clickable:"; } }; }
From source file:org.alfresco.po.share.AddUserGroupPage.java
License:Open Source License
/** * Checks if search button is present and enabled * //from www . j a v a 2 s . c o m * @return boolean */ public boolean isSearchButtonEnabled() { try { WebElement searchButton = driver.findElement(By.cssSelector(SEARCH_BUTTON)); return searchButton.isDisplayed() && searchButton.isEnabled(); } catch (NoSuchElementException e) { throw new PageException("Not found Element:" + SEARCH_BUTTON, e); } }
From source file:org.alfresco.po.share.cmm.admin.CreateNewCustomTypePopUp.java
License:Open Source License
/** * Select close button./*from ww w . jav a 2s . co m*/ * * @return the ManageTypesAndAspectsPage */ public HtmlPage selectCloseButton() { try { WebElement closebutton = driver.findElement(SHARE_DIALOGUE_CLOSE_ICON); if (closebutton.isEnabled() && (closebutton.isDisplayed())) { closebutton.click(); return factoryPage.getPage(driver); } } catch (TimeoutException e) { logger.trace("Unable to select the close button", e); } throw new PageOperationException("Unable to select the closebutton"); }
From source file:org.alfresco.po.share.cmm.admin.CreateNewModelPopUp.java
License:Open Source License
/** * Select close button in CreateNewModelPopupPage * /* ww w.j a v a2s.c o m*/ * @return {@link ModelManagerPage Page} page response */ public HtmlPage selectCloseButton() { try { // Get the Close button web element WebElement closebutton = driver.findElement(SELECT_CLOSE_BUTTON); if (closebutton.isEnabled() && (closebutton.isDisplayed())) { closebutton.click(); // return FactoryShareCMMPage.resolveCMMPage(driver).render(); return factoryPage.instantiatePage(driver, ModelManagerPage.class); } } catch (TimeoutException e) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Unable to select the close button ", e); } } throw new PageOperationException("Unable to select the closebutton"); }
From source file:org.alfresco.po.share.cmm.admin.CreateNewPropertyGroupPopUp.java
License:Open Source License
/** * Select close button.//w ww.j a v a 2s . c om * * @return the model manager page */ public HtmlPage selectCloseButton() { try { WebElement closebutton = driver.findElement(SHARE_DIALOGUE_CLOSE_ICON); if (closebutton.isEnabled() && (closebutton.isDisplayed())) { closebutton.click(); return factoryPage.instantiatePage(driver, ManageTypesAndAspectsPage.class); } } catch (TimeoutException e) { LOGGER.trace("Unable to select the close button ", e); } throw new PageOperationException("Unable to select the closebutton"); }