net.sf.jameleon.plugin.jiffie.util
Class IHTMLElementFinder

java.lang.Object
  extended by net.sf.jameleon.plugin.jiffie.util.IHTMLElementFinder

public class IHTMLElementFinder
extends Object

This class was created to be used by the IEFunctionTag. The idea is to have the logic in this class and simply have have the IEFunctionTag be a facade. This should make unit testing much easier and the IEFunctionTag much smaller.


Field Summary
protected  DocumentDelegate docDelegate
           
 
Constructor Summary
IHTMLElementFinder(DocumentDelegate docDelegate)
           
 
Method Summary
protected  boolean attributeValueMatches(String attributeName, String expectedValue, String actualValue)
           
 IHTMLElement getAreaElementByAltText(String altText)
          Gets the area HTML tag with the given alt text
 String getAttributeValue(IHTMLElement element, String attributeName)
          Gets an attribute's value for a given element
 IHTMLDOMNode getByXPath(String xpath2evaluate)
          This method returns the IHTMLDOMNode identified by the given xpath.
 IHTMLInputElement getCheckbox(String checkboxFieldName)
          Gets the checkbox given by it's field name
 IHTMLInputElement getCheckboxWithNameAndValue(String checkboxFieldName, String checkboxFieldValue)
          Gets the checkbox given by it's field name and value
 IHTMLElement getElementByXPath(String xpath2evaluate)
           
 List getElementsByXPath(String xpath2evaluate)
           
 IHTMLInputElement getFileInputField(String fieldName)
          Gets the file input field given by it's field name
 IHTMLFormElement getForm(String formInfo)
          Tries to get a form via the following methods in order.
 IHTMLElement getFormElement(String htmlTag, String[] attributeNames, String[] attributeValues)
          Gets the first matching element with given attributes and attribute values
 IHTMLElement getFormElement(String htmlTag, String attributeName, String attributeValue)
          Gets the first matching element with a given attribute and attribute value
 List getFormElements(String htmlTag)
          Gets a list of html elements.
 List getFormElements(String htmlTag, String[] attributeNames, String[] attributeValues)
          Gets a list of elements with given attributes and attribute values
 List getFormElements(String htmlTag, String attributeName, String attributeValue)
          Gets a list of elements with a given attribute and attribute value
 ElementList getForms()
           
 IHTMLFormElement getFormWithId(String id)
          Tries to get a form with the id attribute provided
 IHTMLFormElement getFormWithIndex(int index)
          Tries to get the nth form on the page.
 IHTMLFormElement getFormWithName(String name)
          Tries to get a form with the name attribute provided
 IHTMLFormElement getFormWithXPath(String xpath)
          Gets a form with the given XPATH.
 IHTMLFrameBase2 getFrame(ElementContainer container, String attrName, String attrValue)
          Gets a frame by the name attribute
 IHTMLFrameBase2 getFrameWithId(ElementContainer container, String frameId)
          Gets a frame by the id attribute
 IHTMLFrameBase2 getFrameWithId(String frameId)
          Gets a frame by the id attribute
 IHTMLFrameBase2 getFrameWithName(ElementContainer container, String frameName)
          Gets a frame by the name attribute
 IHTMLFrameBase2 getFrameWithName(String frameName)
          Gets a frame by the name attribute
 IHTMLFrameBase2 getFrameWithSrc(ElementContainer container, String frameSrc)
          Gets a frame by the src attribute
 IHTMLFrameBase2 getFrameWithSrc(String frameSrc)
          Gets a frame by the src attribute
 IHTMLInputElement getHiddenField(String fieldName)
          Gets the hidden field given by it's field name
 IHTMLElement getIHTMLElement(ElementContainer container, String htmlTag, String[] attributeNames, String[] attributeValues)
          Gets the first matching IHTMLElement with the given html tag, attributes and attribute values
 IHTMLElement getIHTMLElement(ElementContainer container, String htmlTag, String attributeName, String attributeValue)
          Gets the first matching IHTMLElement with the given html tag, attribute and attribute value
 IHTMLElement getIHTMLElement(String htmlTag, String[] attributeNames, String[] attributeValues)
          Gets the first matching IHTMLElement with the given html tag, attributes and attribute values
 IHTMLElement getIHTMLElement(String htmlTag, String attributeName, String attributeValue)
          Gets the first matching IHTMLElement with the given html tag, attribute and attribute value
 List getIHTMLElements(ElementContainer container, String htmlTag, String[] attributeNames, String[] attributeValues)
          Gets a List of matching IHTMLElements with the given html tag, attributes and attribute values
 List getIHTMLElements(ElementContainer container, String htmlTag, String attributeName, String attributeValue)
          Gets a List of matching IHTMLElements with the given html tag, attribute and attribute value
 List getIHTMLElements(String htmlTag, String[] attributeNames, String[] attributeValues)
          Gets a List of matching IHTMLElements with the given html tag, attributes and attribute values
 List getIHTMLElements(String htmlTag, String attributeName, String attributeValue)
          Gets a List of matching IHTMLElements with the given html tag, attribute and attribute value
 IHTMLAnchorElement getImageLinkWithAltText(String text)
          Helper method to find a link with given img alt text
 IHTMLInputElement getInputFieldByName(String inputFieldName)
          Tries to get an input field by name.
 List getInputFieldsByName(String inputFieldName)
          Tries to get an input field by name.
 IHTMLAnchorElement getLink(String text)
          Tries to get a link via the following methods in order.
 List getLinksWith(String text)
          Helper method to find all links with contained text
 IHTMLAnchorElement getLinkWith(String text)
          Helper method to find a link with contained text
 IHTMLAnchorElement getLinkWithHref(String regex, String text)
          Helper method to find a link with the regex found in the href, and the text contained in the inner text, ID, or name.
 IHTMLAnchorElement getLinkWithID(String id)
          Helper method to find a link with given id
 IHTMLAnchorElement getLinkWithImageSrc(String src)
          Helper method to find a link with given img src attribute
 IHTMLAnchorElement getLinkWithName(String name)
          Helper method to find a link with given name
 IHTMLInputElement getPasswordField(String passwordFieldName)
          Gets the text field given by it's field name
 IHTMLInputElement getRadioButton(String radioButtonName, String value)
          Gets the radio button with the specified name and value
 IHTMLOptionElement getSelectedOptionField(String selectFieldName)
          Gets the currently selected option from the given select field defined by selectFieldName
 IHTMLSelectElement getSelectField(String selectFieldName)
          Gets the select field defined by selectFieldName
 IHTMLOptionElement getSelectOptionWithText(String selectFieldName, String displayedText)
          Gets the currently selected option from the given select field defined by selectFieldName
 IHTMLInputElement getSubmit(String id)
          Tries to get a submit element in the following order.
 IHTMLInputElement getSubmit(String type, String value)
          Gets the submit button identified by it's value (the label shown in the browser).
 IHTMLInputElement getSubmitButtonWithName(String buttonName)
          Gets a submit button by it's name from the working form
 IHTMLInputElement getSubmitButtonWithNameAndValue(String buttonName, String value)
          Gets the first submit button by it's name from the working form
 IHTMLInputElement getSubmitButtonWithValue(String value)
          Gets the first submit button by it's value from the working form
 IHTMLTextAreaElement getTextArea(String fieldName)
          Gets the text area given by it's field name
 IHTMLInputElement getTextField(String fieldName)
          Gets the text field given by it's field name
 void highlightElement(IHTMLElement element)
           
 void highlightFormField(IHTMLElement element)
           
protected  IHTMLFrameBase2 internalGetFrame(ElementContainer container, String attrName, String attrValue)
          Gets a frame by the specified attribute
 boolean isTextInPage(String text)
          Checks to see if the current page has the desired block of text
 List parseStringOfTokens(String tokenSeparatedList, String token)
          Parses a comma-separated list.
protected  void release(IDispatch dis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

docDelegate

protected DocumentDelegate docDelegate
Constructor Detail

IHTMLElementFinder

public IHTMLElementFinder(DocumentDelegate docDelegate)
Method Detail

getAreaElementByAltText

public IHTMLElement getAreaElementByAltText(String altText)
Gets the area HTML tag with the given alt text

Parameters:
altText - - the alt text that the desired area tag should have
Returns:
A matching area tag

getAttributeValue

public String getAttributeValue(IHTMLElement element,
                                String attributeName)
Gets an attribute's value for a given element

Parameters:
element - - The element that contains the attribute
attributeName - - The name of the attribute with the desired value
Returns:
the value for a attribute Contributed by Alex Eagar

getByXPath

public IHTMLDOMNode getByXPath(String xpath2evaluate)
This method returns the IHTMLDOMNode identified by the given xpath. The IHTMLDOMNode could be either an IHTMLElement, an IHTMLDOMAttribute or an IHTMLDOMTextNode.

Parameters:
xpath2evaluate - - The xpath identifying the wanted node in the DOM.
Returns:
Depending on the given xpath either IHTMLElement, IHTMLDOMAttribute or IHTMLDOMTextNode.

getCheckbox

public IHTMLInputElement getCheckbox(String checkboxFieldName)
Gets the checkbox given by it's field name

Parameters:
checkboxFieldName - - the name of the checkbox
Returns:
the checkbox representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

getCheckboxWithNameAndValue

public IHTMLInputElement getCheckboxWithNameAndValue(String checkboxFieldName,
                                                     String checkboxFieldValue)
Gets the checkbox given by it's field name and value

Parameters:
checkboxFieldName - - the name of the checkbox
checkboxFieldValue - - the value of the checkbox
Returns:
the checkbox representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

getElementByXPath

public IHTMLElement getElementByXPath(String xpath2evaluate)
Parameters:
xpath2evaluate - - The XPath identifying the element
Returns:
The IHTMLElement identified by the given XPath. Null ifthe XPath does not identify any element.

getElementsByXPath

public List getElementsByXPath(String xpath2evaluate)
Parameters:
xpath2evaluate - - The XPath identifying the element
Returns:
A List of matching elements

getFrameWithId

public IHTMLFrameBase2 getFrameWithId(ElementContainer container,
                                      String frameId)
Gets a frame by the id attribute

Parameters:
container - - the ElementContainer that contains the desired frame.
frameId - - the id of the frame
Returns:
the frame represented by the frame id

getFrameWithId

public IHTMLFrameBase2 getFrameWithId(String frameId)
Gets a frame by the id attribute

Parameters:
frameId - - the id of the frame
Returns:
the frame represented by the frame id

getFrameWithName

public IHTMLFrameBase2 getFrameWithName(ElementContainer container,
                                        String frameName)
Gets a frame by the name attribute

Parameters:
container - - the ElementContainer that contains the desired frame.
frameName - - the name of the frame
Returns:
the frame represented by the frame name

getFrameWithName

public IHTMLFrameBase2 getFrameWithName(String frameName)
Gets a frame by the name attribute

Parameters:
frameName - - the name of the frame
Returns:
the frame represented by the frame name

getFrameWithSrc

public IHTMLFrameBase2 getFrameWithSrc(ElementContainer container,
                                       String frameSrc)
Gets a frame by the src attribute

Parameters:
container - - the ElementContainer that contains the desired frame.
frameSrc - - the source of the frame
Returns:
the frame represented by the frame src

getFrameWithSrc

public IHTMLFrameBase2 getFrameWithSrc(String frameSrc)
Gets a frame by the src attribute

Parameters:
frameSrc - - the source of the frame
Returns:
the frame represented by the frame src

getFrame

public IHTMLFrameBase2 getFrame(ElementContainer container,
                                String attrName,
                                String attrValue)
Gets a frame by the name attribute

Parameters:
container - - the ElementContainer that contains the desired frame.
attrName - - the attribute with which to find the frame(name/id/src)
attrValue - - the name,id, or src of the frame. This can be a comma-separated list of names, ids or srcs.
Returns:
the frame represented by the frame name

internalGetFrame

protected IHTMLFrameBase2 internalGetFrame(ElementContainer container,
                                           String attrName,
                                           String attrValue)
Gets a frame by the specified attribute

Parameters:
container - - the ElementContainer that contains the desired frame.
attrName - - the attribute with which to find the frame (name, id, src)
attrValue - - the name,id, or src of the frame
Returns:
the frame represented by the frame name

parseStringOfTokens

public List parseStringOfTokens(String tokenSeparatedList,
                                String token)
Parses a comma-separated list.

Parameters:
tokenSeparatedList - - A token-delimited String
token - - The token to parse the String with
Returns:
A List of tokens from the comma-separated list

getForm

public IHTMLFormElement getForm(String formInfo)
Tries to get a form via the following methods in order.
  1. getFormWithId() - Gets a form with the expected id attribute
  2. getFormWithName() - Gets a form with the expected name attribute
  3. getFormWithIndex() - The parameter is converted to a number, representing the index of the form on the page.
  4. getFormWithXPath - Gets a form with the expected XPath

Parameters:
formInfo - - The form id or name or index or XPath identifying the form
Returns:
the first form that corresponds to the above mentioned or null if no Form is found.

getFormElement

public IHTMLElement getFormElement(String htmlTag,
                                   String attributeName,
                                   String attributeValue)
Gets the first matching element with a given attribute and attribute value

Parameters:
htmlTag - - The name of the element or tag. For an input element, you'd pass "input"
attributeName - - The name of the attribute to exist in the element.
attributeValue - - The value of the name attribute to exist in the element.

getFormElement

public IHTMLElement getFormElement(String htmlTag,
                                   String[] attributeNames,
                                   String[] attributeValues)
Gets the first matching element with given attributes and attribute values

Parameters:
htmlTag - - The name of the element or tag. For an input element, you'd pass "input"
attributeNames - - A List of names of attributes to exist in the element.
attributeValues - - A List of values of name attributes to exist in the element. Must be in the same order as attributeNames

getFormElements

public List getFormElements(String htmlTag)
Gets a list of html elements.

Parameters:
htmlTag - - The name of the element or tag. For an input element, you'd pass "input"

getFormElements

public List getFormElements(String htmlTag,
                            String attributeName,
                            String attributeValue)
Gets a list of elements with a given attribute and attribute value

Parameters:
htmlTag - - The name of the element or tag. For an input element, you'd pass "input"
attributeName - - The name of the attribute to exist in the element.
attributeValue - - The value of the name attribute to exist in the element.

getFormElements

public List getFormElements(String htmlTag,
                            String[] attributeNames,
                            String[] attributeValues)
Gets a list of elements with given attributes and attribute values

Parameters:
htmlTag - - The name of the element or tag. For an input element, you'd pass "input"
attributeNames - - A List of names of attributes to exist in the element.
attributeValues - - A List of values of name attributes to exist in the element. Must be in the same order as attributeNames

getForms

public ElementList getForms()

getFormWithId

public IHTMLFormElement getFormWithId(String id)
Tries to get a form with the id attribute provided

Parameters:
id - - The name of the form to be returned.
Returns:
a form with corresponding to the given name.

getFormWithIndex

public IHTMLFormElement getFormWithIndex(int index)
Tries to get the nth form on the page. When a form has no id or name attribute defined, this method gets all of the forms on the page and returns the nth form, defined by index

Parameters:
index - - The number representing the (n-1)th form. The first form would be 0
Returns:
a form with corresponding to the given name.

getFormWithName

public IHTMLFormElement getFormWithName(String name)
Tries to get a form with the name attribute provided

Parameters:
name - - The name of the form to be returned.
Returns:
a form with corresponding to the given name.

getFormWithXPath

public IHTMLFormElement getFormWithXPath(String xpath)
Gets a form with the given XPATH.

Parameters:
xpath - - the XPATH of the form
Returns:
the form matching the provided XPATH.

getHiddenField

public IHTMLInputElement getHiddenField(String fieldName)
Gets the hidden field given by it's field name

Parameters:
fieldName - - the name of the hidden field
Returns:
the hidden field representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

getIHTMLElement

public IHTMLElement getIHTMLElement(ElementContainer container,
                                    String htmlTag,
                                    String attributeName,
                                    String attributeValue)
Gets the first matching IHTMLElement with the given html tag, attribute and attribute value

Parameters:
container - - The ElementContainer to use to get the attributes out of.
htmlTag - - The HTML tag to get back.
attributeName - - the attibute in the HTML element
attributeValue - - the value of attibute in the HTML element
Returns:
the first matching IHTMLElement with the given html tag, attribute and attribute value

getIHTMLElement

public IHTMLElement getIHTMLElement(String htmlTag,
                                    String attributeName,
                                    String attributeValue)
Gets the first matching IHTMLElement with the given html tag, attribute and attribute value

Parameters:
htmlTag - - The HTML tag to get back.
attributeName - - the attibute in the HTML element
attributeValue - - the value of attibute in the HTML element
Returns:
the first matching IHTMLElement with the given html tag, attribute and attribute value

getIHTMLElement

public IHTMLElement getIHTMLElement(ElementContainer container,
                                    String htmlTag,
                                    String[] attributeNames,
                                    String[] attributeValues)
Gets the first matching IHTMLElement with the given html tag, attributes and attribute values

Parameters:
container - - The ElementContainer to use to get the attributes out of.
htmlTag - - The HTML tag to get back.
attributeNames - - a list of attibutes in the HTML element
attributeValues - - a list of values of attibutes in the same order as the names
Returns:
the first matching IHTMLElement with the given html tag, attribute and attribute value

getIHTMLElement

public IHTMLElement getIHTMLElement(String htmlTag,
                                    String[] attributeNames,
                                    String[] attributeValues)
Gets the first matching IHTMLElement with the given html tag, attributes and attribute values

Parameters:
htmlTag - - The HTML tag to get back.
attributeNames - - a list of attibutes in the HTML element
attributeValues - - a list of values of attibutes in the same order as the names
Returns:
the first matching IHTMLElement with the given html tag, attribute and attribute value

getIHTMLElements

public List getIHTMLElements(ElementContainer container,
                             String htmlTag,
                             String attributeName,
                             String attributeValue)
Gets a List of matching IHTMLElements with the given html tag, attribute and attribute value

Parameters:
container - - The ElementContainer to use to get the attributes out of.
htmlTag - - The HTML tag to get back.
attributeName - - the attibute in the HTML element
attributeValue - - the value of attibute in the HTML element
Returns:
a List of matching IHTMLElements with the given html tag, attribute and attribute value

getIHTMLElements

public List getIHTMLElements(String htmlTag,
                             String attributeName,
                             String attributeValue)
Gets a List of matching IHTMLElements with the given html tag, attribute and attribute value

Parameters:
htmlTag - - The HTML tag to get back.
attributeName - - the attibute in the HTML element
attributeValue - - the value of attibute in the HTML element
Returns:
a List of matching IHTMLElements with the given html tag, attribute and attribute value

getIHTMLElements

public List getIHTMLElements(ElementContainer container,
                             String htmlTag,
                             String[] attributeNames,
                             String[] attributeValues)
Gets a List of matching IHTMLElements with the given html tag, attributes and attribute values

Parameters:
container - - The ElementContainer to use to get the attributes out of.
htmlTag - - The HTML tag to get back.
attributeNames - - a list of attibutes in the HTML element
attributeValues - - a list of values of attibutes in the same order as the names
Returns:
a List of matching IHTMLElements with the given html tag, attribute and attribute value

getIHTMLElements

public List getIHTMLElements(String htmlTag,
                             String[] attributeNames,
                             String[] attributeValues)
Gets a List of matching IHTMLElements with the given html tag, attributes and attribute values

Parameters:
htmlTag - - The HTML tag to get back.
attributeNames - - a list of attibutes in the HTML element
attributeValues - - a list of values of attibutes in the same order as the names
Returns:
a List of matching IHTMLElements with the given html tag, attribute and attribute value

getImageLinkWithAltText

public IHTMLAnchorElement getImageLinkWithAltText(String text)
Helper method to find a link with given img alt text

Parameters:
text - - The alt text of the img contained by the link
Returns:
The IHTMLAnchorElement for the link

getInputFieldByName

public IHTMLInputElement getInputFieldByName(String inputFieldName)
Tries to get an input field by name. This method does not care what type of input field it is.

Parameters:
inputFieldName - - The name of the input field that exists in the current working form
Returns:
the first element with the provided name.

getInputFieldsByName

public List getInputFieldsByName(String inputFieldName)
Tries to get an input field by name. This method does not care what type of input field it is.

Parameters:
inputFieldName - - The name of the input field that exists in the current working form
Returns:
the first element with the provided name.

getLink

public IHTMLAnchorElement getLink(String text)
Tries to get a link via the following methods in order.
  1. getLinkWith() - Gets a link with the diplayed text
  2. getLinkWithID() - Gets a link with the id attribute set.
  3. getImageLinkWithAltText - Gets a link with the alt attribute or alt text.
  4. getLinkWithName() - Gets a link with the name attribute set.
  5. getLinkWithImageSrc() - Gets a link with the image src.

Parameters:
text - - The link text or the link id or the alt text or the link name.
Returns:
the first link that corresponds to the above mentioned or null if no WebLink is found. todo order should be id, name, label, imageText.

getLinkWith

public IHTMLAnchorElement getLinkWith(String text)
Helper method to find a link with contained text

Parameters:
text - - The text contained by the link
Returns:
The IHTMLAnchorElement for the link

getLinkWithHref

public IHTMLAnchorElement getLinkWithHref(String regex,
                                          String text)
Helper method to find a link with the regex found in the href, and the text contained in the inner text, ID, or name.

Parameters:
regex - - The regex to be found in the href attribute of the link
text - - The text contained by the link
Returns:
The IHTMLAnchorElement for the link

getLinksWith

public List getLinksWith(String text)
Helper method to find all links with contained text

Parameters:
text - - The text contained by the links
Returns:
The IHTMLAnchorElement for the link

getLinkWithID

public IHTMLAnchorElement getLinkWithID(String id)
Helper method to find a link with given id

Parameters:
id - - The id of the link
Returns:
The IHTMLAnchorElement for the link

getLinkWithImageSrc

public IHTMLAnchorElement getLinkWithImageSrc(String src)
Helper method to find a link with given img src attribute

Parameters:
src - - The part of the src attribute of the img contained by the link
Returns:
The IHTMLAnchorElement for the link

getLinkWithName

public IHTMLAnchorElement getLinkWithName(String name)
Helper method to find a link with given name

Parameters:
name - - The name of the link to find
Returns:
The IHTMLAnchorElement for the link

getPasswordField

public IHTMLInputElement getPasswordField(String passwordFieldName)
Gets the text field given by it's field name

Parameters:
passwordFieldName - - the name of the password field
Returns:
the password field representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

getRadioButton

public IHTMLInputElement getRadioButton(String radioButtonName,
                                        String value)
Gets the radio button with the specified name and value

Parameters:
radioButtonName - - the name of the radio button
value - - the value to set the radio button to.
Returns:
a radio button with the specified name and valud

getSelectField

public IHTMLSelectElement getSelectField(String selectFieldName)
Gets the select field defined by selectFieldName

Parameters:
selectFieldName - - the name of the select field
Returns:
the select field matching the selectFieldName.

getSelectedOptionField

public IHTMLOptionElement getSelectedOptionField(String selectFieldName)
Gets the currently selected option from the given select field defined by selectFieldName

Parameters:
selectFieldName - - the name of the select field
Returns:
the select option currently selected.

getSelectOptionWithText

public IHTMLOptionElement getSelectOptionWithText(String selectFieldName,
                                                  String displayedText)
Gets the currently selected option from the given select field defined by selectFieldName

Parameters:
selectFieldName - - the name of the select field
displayedText - - the text displayed in the browser
Returns:
the select option currently selected.

getSubmit

public IHTMLInputElement getSubmit(String id)
Tries to get a submit element in the following order.
  1. <input type="submit" value="...">
  2. <input type="image" src="...">
  3. <input type="button" value="...">

Parameters:
id - - The identifier of the submit element to find. For submit and button types, it will try to match it with the value attribute. For image input types, it will try to match it with the src or alt attribute.
Returns:
The input element. todo support find .

getSubmit

public IHTMLInputElement getSubmit(String type,
                                   String value)
Gets the submit button identified by it's value (the label shown in the browser). Supported ways of finding a submit are:
<input type="submit" value="some value">
<input type="image" src="jameleon.jpg" alt="alt text">
<input type="button" value="some value" onclick="submit();">
<button id="button tag" type="submit">button tag</button>

Parameters:
type - - type of submit field 'submit', 'image' or 'button'
value - - the value of the submit field (this is the label of the submit button shown in the browser)
Returns:
the input field representing the submit button or null if not found.
Throws:
RuntimeException - if the field does not exist in the form. todo introduce constants for supported types.

getSubmitButtonWithName

public IHTMLInputElement getSubmitButtonWithName(String buttonName)
Gets a submit button by it's name from the working form

Parameters:
buttonName - - the name of the submit button
Returns:
the submit button with the provided buttonName
Throws:
RuntimeException - if the desired submit button isn't found in the working form.

getSubmitButtonWithNameAndValue

public IHTMLInputElement getSubmitButtonWithNameAndValue(String buttonName,
                                                         String value)
Gets the first submit button by it's name from the working form

Parameters:
buttonName - - the name of the submit button
value - - the value attribute of the button
Returns:
the submit button with the provided buttonName and value.
Throws:
RuntimeException - if the desired submit button isn't found in the working form.

getSubmitButtonWithValue

public IHTMLInputElement getSubmitButtonWithValue(String value)
Gets the first submit button by it's value from the working form

Parameters:
value - - the value attribute of the button
Returns:
the submit button with the provided value.
Throws:
RuntimeException - if the desired submit button isn't found in the working form.

getTextField

public IHTMLInputElement getTextField(String fieldName)
Gets the text field given by it's field name

Parameters:
fieldName - - the name of the text field
Returns:
the text field representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

getFileInputField

public IHTMLInputElement getFileInputField(String fieldName)
Gets the file input field given by it's field name

Parameters:
fieldName - - the name of the file input field
Returns:
the file input field representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

getTextArea

public IHTMLTextAreaElement getTextArea(String fieldName)
Gets the text area given by it's field name

Parameters:
fieldName - - the name of the text area
Returns:
the text area representing the field name.
Throws:
RuntimeException - if the field does not exist in the form.

isTextInPage

public boolean isTextInPage(String text)
Checks to see if the current page has the desired block of text

Parameters:
text - - the expected text
Returns:
True if the expected text is found

release

protected void release(IDispatch dis)

highlightElement

public void highlightElement(IHTMLElement element)

highlightFormField

public void highlightFormField(IHTMLElement element)

attributeValueMatches

protected boolean attributeValueMatches(String attributeName,
                                        String expectedValue,
                                        String actualValue)


Copyright © 2004-2008 Christian Hargraves. All Rights Reserved.