List of usage examples for org.openqa.selenium WebElement clear
void clear();
From source file:org.alfresco.po.share.dashlet.InsertOrEditImagePage.java
License:Open Source License
/** * This method sets the given description into image description field. * * @param desc String// w ww. jav a 2s . com */ public void setDescription(String desc) { if (desc == null) { throw new IllegalArgumentException("Description should not be null"); } try { WebElement descriptionField = findAndWait(IMAGE_DESC_CSS); descriptionField.clear(); descriptionField.sendKeys(desc); } catch (TimeoutException te) { logger.info("Unable to find the image descrption field.", te); throw new PageOperationException("Unable to find image descrption field."); } }
From source file:org.alfresco.po.share.dashlet.InsertOrEditImagePage.java
License:Open Source License
/** * This method sets the given description into image description field. * * @param width long//from w w w .ja va2s. c om * @param height long */ public void setDimensions(long width, long height) { if (width < 0 || height < 0) { throw new IllegalArgumentException("Width or Height of Image values should not be less than 0"); } try { WebElement widthElement = findAndWait(DIMENSIONS_WIDTH_CSS1); widthElement.clear(); widthElement.sendKeys(Long.valueOf(width).toString()); WebElement heightElement = findAndWait(DIMENSIONS_HEIGHT_CSS2); heightElement.clear(); heightElement.sendKeys(Long.valueOf(height).toString()); } catch (TimeoutException te) { logger.info("Unable to find the image dimensions field.", te); throw new PageOperationException("Unable to find image dimensions field.", te); } }
From source file:org.alfresco.po.share.dashlet.InsertOrEditLinkPage.java
License:Open Source License
/** * This method sets the given text into title. * // w w w . ja va 2s. c o m * @param text String */ public void setTitle(String text) { if (text == null) { throw new IllegalArgumentException("Title is required"); } try { WebElement title = findAndWait(TITLE); title.clear(); title.sendKeys(text); } catch (TimeoutException te) { logger.info("Unable to find the Title field.", te); throw new PageOperationException("Unable to find Title field.", te); } }
From source file:org.alfresco.po.share.dashlet.mydiscussions.CreateNewTopicPage.java
License:Open Source License
public HtmlPage enterTopicTitle(String title) { try {//from ww w . j a v a 2s. co m WebElement inputField = driver.findElement(By.cssSelector(CREATE_NEW_TOPIC_TITLE)); inputField.clear(); inputField.sendKeys(title); return this; } catch (NoSuchElementException nse) { logger.error("Unable to enter topic title.", nse); } throw new PageOperationException("Error in finding the css for topic title input field."); }
From source file:org.alfresco.po.share.dashlet.mydiscussions.CreateNewTopicPage.java
License:Open Source License
/** * Enters tag value/*from www .j a va 2s.co m*/ * * @param tag String */ public HtmlPage fillTagField(String tag) { try { WebElement inputField = driver.findElement(By.cssSelector(TOPIC_TAG_INPUT)); inputField.clear(); inputField.sendKeys(tag); return this; } catch (NoSuchElementException nse) { logger.error("Unable to enter topic tag.", nse); } throw new PageOperationException("Error in finding the css for topic tag input field."); }
From source file:org.alfresco.po.share.dashlet.RssFeedUrlBoxPage.java
License:Open Source License
private void fillField(By selector, String text) { checkNotNull(selector);//from w ww. j av a 2 s . c om checkNotNull(text); WebElement inputField = findAndWait(selector); inputField.clear(); inputField.sendKeys(text); }
From source file:org.alfresco.po.share.dashlet.RssFeedUrlBoxPage.java
License:Open Source License
public void clearUrlField() { try {//from www.j av a 2 s.co m WebElement element = driver.findElement(URL_FIELD); element.clear(); } catch (TimeoutException te) { throw new ShareException("Unable to find Url field", te); } }
From source file:org.alfresco.po.share.dashlet.RssFeedUrlBoxPage.java
License:Open Source License
public String getValidationMessageFromUrlField(String text) { try {//from w ww . j a v a 2s .c o m WebElement element = driver.findElement(URL_FIELD); element.clear(); element.sendKeys(text); clickOk(); return getValidationMessage(element); } catch (TimeoutException te) { throw new ShareException("Unable to find Url field", te); } }
From source file:org.alfresco.po.share.dashlet.SiteSearchDashlet.java
License:Open Source License
/** * Input the given search text and click the search button. * // w w w. ja v a2 s .c om * @param text - The text to be searched * @return {@link SiteSearchDashlet} */ public SiteSearchDashlet search(String text) { try { WebElement inputElement = findAndWait(INPUT_BOX); inputElement.clear(); inputElement.sendKeys(text); findAndWait(SEARCH_BUTTON).click(); waitUntilElementDisappears(LOADING_MESSAGE, TimeUnit.SECONDS.convert(getDefaultWaitTime(), TimeUnit.MILLISECONDS)); } catch (TimeoutException e) { logger.error("Not able to search ", e); } return this; }
From source file:org.alfresco.po.share.dashlet.TopSiteContributorDashlet.java
License:Open Source License
/** * Enters from date into calendar/*ww w . jav a2s. c om*/ * * @param fromDate String * @return HtmlPage */ public HtmlPage enterFromDate(final String fromDate) { if (fromDate == null || fromDate.isEmpty()) { throw new UnsupportedOperationException("From date is required"); } try { WebElement input = findAndWait(By.cssSelector(FROM_DATE_INPUT_FIELD)); input.clear(); input.sendKeys(fromDate); if (logger.isTraceEnabled()) { logger.trace("From date entered: " + fromDate); } return getCurrentPage(); } catch (TimeoutException nse) { throw new PageException("Calendar from date drop down not displayed."); } }