net.sourceforge.jwebunit.htmlunit
Class HtmlUnitElementImpl

java.lang.Object
  extended by net.sourceforge.jwebunit.htmlunit.HtmlUnitElementImpl
All Implemented Interfaces:
IElement

public class HtmlUnitElementImpl
extends java.lang.Object
implements IElement

HtmlUnit implementation of IElement wrapper.

Author:
jmwright

Constructor Summary
HtmlUnitElementImpl(com.gargoylesoftware.htmlunit.html.HtmlElement element)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Two IElements are equal if they refer to the same element in the current page.
 java.lang.String getAttribute(java.lang.String name)
          Get the value of an attribute.
 java.util.List<IElement> getChildren()
          Get direct child elements of this element.
 IElement getElement(java.lang.String xpath)
          Get an element from this element by xpath.
 java.util.List<IElement> getElements(java.lang.String xpath)
          Get all elements from this element by xpath.
 com.gargoylesoftware.htmlunit.html.HtmlElement getHtmlElement()
          Return the unwrapped HtmlUnit element that this IElement represents.
 java.lang.String getName()
          Get the element name, for example "input", "textarea", "select".
 IElement getParent()
          Get the parent element, or null if none exists.
 java.lang.String getTextContent()
          Get the text content, if any, of this element.
 int hashCode()
           
 void setAttribute(java.lang.String string)
          Set an attribute on this element.
 void setAttribute(java.lang.String string, java.lang.String value)
          Set an attribute on this element.
 void setTextContent(java.lang.String value)
          Set the text content on this element.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlUnitElementImpl

public HtmlUnitElementImpl(com.gargoylesoftware.htmlunit.html.HtmlElement element)
Method Detail

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Description copied from interface: IElement
Get the value of an attribute.

Specified by:
getAttribute in interface IElement
Parameters:
name - The attribute name
Returns:
The value of the attribute

getName

public java.lang.String getName()
Description copied from interface: IElement
Get the element name, for example "input", "textarea", "select".

Specified by:
getName in interface IElement
Returns:
The element name

getChildren

public java.util.List<IElement> getChildren()
Description copied from interface: IElement
Get direct child elements of this element.

Specified by:
getChildren in interface IElement
Returns:
A list of child elements

getParent

public IElement getParent()
Description copied from interface: IElement
Get the parent element, or null if none exists.

Specified by:
getParent in interface IElement
Returns:
The parent element or null

getTextContent

public java.lang.String getTextContent()
Description copied from interface: IElement
Get the text content, if any, of this element.

Specified by:
getTextContent in interface IElement
Returns:
The text content, if any, of this element.

getElement

public IElement getElement(java.lang.String xpath)
Description copied from interface: IElement
Get an element from this element by xpath.

Specified by:
getElement in interface IElement
Parameters:
xpath - The xpath to serach
Returns:
an IElement if found, or null

getElements

public java.util.List<IElement> getElements(java.lang.String xpath)
Description copied from interface: IElement
Get all elements from this element by xpath.

Specified by:
getElements in interface IElement
Parameters:
xpath - The xpath to search
Returns:
A list of all matching elements

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setAttribute

public void setAttribute(java.lang.String string)
Description copied from interface: IElement
Set an attribute on this element.

Specified by:
setAttribute in interface IElement

setAttribute

public void setAttribute(java.lang.String string,
                         java.lang.String value)
Description copied from interface: IElement
Set an attribute on this element.

Specified by:
setAttribute in interface IElement

setTextContent

public void setTextContent(java.lang.String value)
Description copied from interface: IElement
Set the text content on this element.

Specified by:
setTextContent in interface IElement

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: IElement
Two IElements are equal if they refer to the same element in the current page.

Specified by:
equals in interface IElement
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare
Returns:
true if the object is an IElement, and refers to the same element as this IElement

getHtmlElement

public com.gargoylesoftware.htmlunit.html.HtmlElement getHtmlElement()
Return the unwrapped HtmlUnit element that this IElement represents.

Returns:
the HtmlUnit element this IElement represents.


Copyright © 2002-2011 SourceForge. All Rights Reserved.