const classafBounce::Element
sys::Obj afBounce::Element
(HTML Element) Represents a generic HTML element.
- classs
Str? classs()
Returns the
class
attribute as declared by the element, otherwisenull
.- elementName
Str elementName()
Returns the name of the the element. e.g.
div
- exists
Bool exists()
Returns
true
if this element exists.- find
Finds elements inside this element.
- getAtIndex
@
Operator
This getAtIndex(Int index)Returns the element of the current selection at the specified index. Use -1 to select from the end of the list. Usage:
value := element[-2]
Note this method is safe and does NOT throw an Err should the index be out of bounds. Instead use
verifyDoesNotExist()
.Also note that this returns different results to the CSS selector
:nth-child
.- getAttr
@
Operator
Str? getAttr(Str name)Returns the value of the named attribute. Returns
null
if it does not exist. Usage:value := element["value"]
- hasClass
Returns
true
if the element contains the given value.The match is done on a whitespace split of the class attribute and is case insensitive.
- html
Str html()
Returns the markup generated by this node, including the element itself.
- id
Str? id()
Returns the
id
as declared by the element. Returnsnull
if the element does not have anid
attribute.- innerHtml
Str innerHtml()
Returns the markup generated by the children of this node.
- list
Element[] list()
Return all elements as a list.
- makeFromCss
new makeFromCss(Str cssSelector)
- size
Int size()
Returns the number of elements found by the selector
- submitForm
virtual ButterResponse submitForm()
Submits an enclosing form to Bed App.
- text
Str text()
Returns the text content of this element and it's child elements.
- toCheckBox
CheckBox toCheckBox()
Returns this element as a CheckBox
- toHidden
Hidden toHidden()
Returns this element as a Hidden input
- toLink
Link toLink()
Returns this element as a Link
- toOption
Option toOption()
Returns this element as a Link
- toSelectBox
SelectBox toSelectBox()
Returns this element as a SelectBox
- toStr
virtual override Str toStr()
Returns the complete CSS selector and the resulting HTML.
- toSubmitButton
SubmitButton toSubmitButton()
Returns this element as a SubmitButton
- toTextBox
TextBox toTextBox()
Returns this element as a TextBox
- verifyAttrEq
Void verifyAttrEq(Str attrName, Obj expected)
Verify that the element has the given attribute.
- verifyClassContains
Void verifyClassContains(Obj expected)
Verify that the current selection has the given size.
- verifyDoesNotExist
Void verifyDoesNotExist()
Verify that the current selection heralds no elements, otherwise throw a test failure exception.
- verifyExists
Void verifyExists()
Verify that at least one element is selected from the document, otherwise throw a test failure exception.
- verifySizeEq
Void verifySizeEq(Int expectedSize)
Verify that the current selection has the given size.
- verifyTextContains
Void verifyTextContains(Obj contains)
Verify that the element text contains the given str. The match is case insensitive.
- verifyTextEq
Void verifyTextEq(Obj expected)
Verify that the given text matches the text of the element. The match is case insensitive.
- xelems
XElem[] xelems()
Return the underlying
XElem
objects