|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jelly.TagSupport
net.sf.jameleon.LocationAwareTagSupport
net.sf.jameleon.JameleonTagSupport
net.sf.jameleon.function.FunctionTag
net.sf.jameleon.plugin.watij.WatijFunctionTag
net.sf.jameleon.plugin.watij.tags.AbstractWatijGetTag
net.sf.jameleon.plugin.watij.tags.WatijAssertHtmlElementTag
public class WatijAssertHtmlElementTag
Gets an HtmlElement on the page and validates its attributes and inner text. For example, to get a button on the page and verify various things about it:
To simply test that the element exists:<testcase xmlns="jelly:jameleon" xmlns:j="jelly:core"> <watij-session baseUrl="http://jameleon.sourceforge.net/jiffie-plugin/forms/sampleForm.html" beginSession="true"> <watij-assert-html-element functionId="Validate the 'submit' button" how="name" what="submit" value="Go" type="button" /> </watij-session> </testcase>
To test that the element does not exist:<testcase xmlns="jelly:jameleon" xmlns:j="jelly:core"> <watij-session baseUrl="http://jameleon.sourceforge.net/jiffie-plugin/forms/sampleForm.html" beginSession="true"> <watij-assert-html-element functionId="Validate the 'submit' button" how="name" what="submit" /> </watij-session> </testcase>
To verify the followig XPath returns a tag:<testcase xmlns="jelly:jameleon" xmlns:j="jelly:core"> <watij-session baseUrl="http://jameleon.sourceforge.net/jiffie-plugin/forms/sampleForm.html" beginSession="true"> <watij-assert-html-element functionId="Validate the 'submit' button" how="name" what="submit" exists="false" /> </watij-session> </testcase>
The above can then be used to verify various other things once the tag is returned. However, XPath should be able to verify everything w/o having to do additional validation of the attributes. If only symbol and element are defined, then the tag will be tested for existence. See the javadocs on watij's<testcase xmlns="jelly:jameleon" xmlns:j="jelly:core"> <watij-session baseUrl="http://jameleon.sourceforge.net/jiffie-plugin/forms/sampleForm.html" beginSession="true"> <watij-assert-html-element functionId="Validate the 'submit' button" how="xpath" what="//INPUT[@name='submit']" /> </watij-session> </testcase>
SymbolFactory
for a complete list of supported symbols.
Field Summary | |
---|---|
protected Boolean |
disabled
To validate the element is enabled set this to false. |
protected boolean |
exists
To check that it exists or not. |
protected String |
id
The expected id |
protected String |
innerText
The inner text of the element |
protected String |
name
The name of the element |
protected String |
style
The style of the element |
protected String |
text
The text nested in the element |
protected String |
title
The title nested in the element |
protected String |
type
The type of the element |
protected String |
value
The value of the element |
Fields inherited from class net.sf.jameleon.plugin.watij.tags.AbstractWatijGetTag |
---|
contextVar, failOnNotExists, how, what |
Fields inherited from class net.sf.jameleon.plugin.watij.WatijFunctionTag |
---|
sessionTag, STORE_SOURCE_CONFIG_NAME, storeSourceOnStateChange |
Fields inherited from class net.sf.jameleon.function.FunctionTag |
---|
addt, breakPoint, expectException, expectFailure, fResults, functionDelay, functionId, lastFileWritten, log, NO_DELAY, params, postcondition, precondition, st, state, tct, vpt |
Fields inherited from class net.sf.jameleon.JameleonTagSupport |
---|
attributes, broker, contextVars, fp, unsupportedAttributes |
Fields inherited from class net.sf.jameleon.LocationAwareTagSupport |
---|
columnNumber, elementTagName, lineNumber, scriptFileName |
Fields inherited from class org.apache.commons.jelly.TagSupport |
---|
body, context, hasTrimmed, parent, shouldTrim |
Constructor Summary | |
---|---|
WatijAssertHtmlElementTag()
|
Method Summary | |
---|---|
void |
assertAttributes(HtmlElement e)
|
HtmlElement |
getHtmlElement(Symbol how,
String what)
Gets the HtmlElement of interest. |
String |
getTagName()
The HTML Element name this tag is used to get. |
void |
testBlock()
|
Methods inherited from class net.sf.jameleon.plugin.watij.tags.AbstractWatijGetTag |
---|
getHtmlElement, getPrefixMsg |
Methods inherited from class net.sf.jameleon.plugin.watij.WatijFunctionTag |
---|
getParentBrowser, getSymbolFromString, ie, setCurrentIE, setupEnvironment, store |
Methods inherited from class net.sf.jameleon.JameleonTagSupport |
---|
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught |
Methods inherited from class net.sf.jameleon.LocationAwareTagSupport |
---|
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber |
Methods inherited from class org.apache.commons.jelly.TagSupport |
---|
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.jelly.Tag |
---|
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent |
Field Detail |
---|
protected boolean exists
protected Boolean disabled
protected String id
protected String innerText
protected String name
protected String style
protected String text
protected String title
protected String type
protected String value
Constructor Detail |
---|
public WatijAssertHtmlElementTag()
Method Detail |
---|
public void testBlock() throws Exception
testBlock
in class AbstractWatijGetTag
Exception
public HtmlElement getHtmlElement(Symbol how, String what) throws Exception
AbstractWatijGetTag
getHtmlElement
in class AbstractWatijGetTag
how
- - How to search for the elementwhat
- - What to search for.
Exception
public String getTagName()
AbstractWatijGetTag
img tag
getTagName
in class AbstractWatijGetTag
public void assertAttributes(HtmlElement e) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |