Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.ClickableElement


      if (!(htmlElement instanceof ClickableElement))
      {
         throw new IllegalStateException("Component with name=" + this.submitComponent + " is not a ClickableElement.");
      }
     
      ClickableElement clickable = (ClickableElement)htmlElement;
      return clickable.click();
   }
View Full Code Here


   *
   * @param page the page to search in
   * @return the button, <code>null</code> if not found
   */
  protected ClickableElement findClickableElementByAttribute(final HtmlPage page) {
    ClickableElement button = null;
    // look for the button in the current form
    if (getContext().getCurrentForm() != null) {
      LOG.debug("Looking for button in current form");
      button = findButton(getContext().getCurrentForm());
    }
View Full Code Here

    }
    return button;
  }

  protected Page findTarget() throws XPathException, IOException, SAXException {
    final ClickableElement button = findClickableElement(getContext().getCurrentHtmlResponse(this));
    if (button == null) {
      throw buildNoButtonFoundException();
    }

    LOG.info("-> findTarget(by " + button.getTagName() + "): name="
        + button.getAttribute("name") + " value="
        + button.getAttribute("value"));

    if (isImageButton()) {
      LOG.info("-> findTarget(by " + button.getTagName() + "): name="
          + button.getAttribute("name") + " value="
          + button.getAttribute("value"));
      return ((HtmlInput) button).click(Integer.parseInt(getX()), Integer.parseInt(getY()));
    }
    return button.click();
  }
View Full Code Here

   * @param form the form in which the button should be searched
   * @return the button, <code>null</code> if not found
   */
  ClickableElement findButton(final HtmlForm form) {
    LOG.debug("Looking for inputs of type submit, image or button in " + form);
    ClickableElement button = findInputButton(form);
    if (button != null) {
      return button;
    }
    LOG.debug("Looking for \"normal\" button in " + form);
    return findNormalButton(form);
View Full Code Here

    if (forms.size() == 0) {
      LOG.warn("No forms found - page probably non-compliant - searching page anyway");
      return searchButton(currentResp);
    }
    for (final Iterator iter = forms.iterator(); iter.hasNext();) {
      ClickableElement button = findButton((HtmlForm) iter.next());
      if (button != null) {
        return button;
      }
    }
    return null;
View Full Code Here

      final HtmlElement elt = (HtmlElement) childElements.next();
      if (isButton(elt)) {
        buttons.add(elt);
      }
    }
    ClickableElement button = findInputButton(buttons.iterator());
    if (button == null) {
      button = findNormalButton(buttons.iterator());
    }
    return button;
  }
View Full Code Here

    * @throws ComponentIDNotFoundException if the component can not be found
    */
   public void clickTreeNodeHandle( String treeNodeKey, String treeNodeId ) throws IOException
   {
     final String handleId = ":"+treeNodeKey+"::"+treeNodeId+":handle";
     ClickableElement icon = (ClickableElement)jsfClient.getElement(handleId);
     if( icon == null ) throw new ComponentIDNotFoundException(handleId);
     icon.click();    
   }
View Full Code Here

    *                                    componentID suffix
    */
   public void clickTab(String tabComponentID)
         throws IOException
   {
      ClickableElement tab = (ClickableElement)jsfClient.getElement(tabComponentID + "_shifted");
      tab.click();
   }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.ClickableElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.