const classafBounce::Element

sys::Obj
  afBounce::Element

(HTML Element) Represents a generic HTML element.

classs

Source

Str? classs()

Returns the class attribute as declared by the element, otherwise null.

elementName

Source

Str elementName()

Returns the name of the the element. e.g. div

exists

Source

Bool exists()

Returns true if this element exists.

find

Source

Element find(Str cssSelector)

Finds elements inside this element.

getAtIndex

Source

@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

Source

@Operator
Str? getAttr(Str name)

Returns the value of the named attribute. Returns null if it does not exist. Usage:

value := element["value"]
hasClass

Source

Bool hasClass(Str value)

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

Source

Str html()

Returns the markup generated by this node, including the element itself.

id

Source

Str? id()

Returns the id as declared by the element. Returns null if the element does not have an id attribute.

innerHtml

Source

Str innerHtml()

Returns the markup generated by the children of this node.

list

Source

Element[] list()

Return all elements as a list.

makeFromCss

Source

new makeFromCss(Str cssSelector)

size

Source

Int size()

Returns the number of elements found by the selector

submitForm

Source

virtual ButterResponse submitForm()

Submits an enclosing form to Bed App.

text

Source

Str text()

Returns the text content of this element and it's child elements.

toCheckBox

Source

CheckBox toCheckBox()

Returns this element as a CheckBox

toHidden

Source

Hidden toHidden()

Returns this element as a Hidden input

Source

Link toLink()

Returns this element as a Link

toOption

Source

Option toOption()

Returns this element as a Link

toSelectBox

Source

SelectBox toSelectBox()

Returns this element as a SelectBox

toStr

Source

virtual override Str toStr()

Returns the complete CSS selector and the resulting HTML.

toSubmitButton

Source

SubmitButton toSubmitButton()

Returns this element as a SubmitButton

toTextBox

Source

TextBox toTextBox()

Returns this element as a TextBox

verifyAttrEq

Source

Void verifyAttrEq(Str attrName, Obj expected)

Verify that the element has the given attribute.

verifyClassContains

Source

Void verifyClassContains(Obj expected)

Verify that the current selection has the given size.

verifyDoesNotExist

Source

Void verifyDoesNotExist()

Verify that the current selection heralds no elements, otherwise throw a test failure exception.

verifyExists

Source

Void verifyExists()

Verify that at least one element is selected from the document, otherwise throw a test failure exception.

verifySizeEq

Source

Void verifySizeEq(Int expectedSize)

Verify that the current selection has the given size.

verifyTextContains

Source

Void verifyTextContains(Obj contains)

Verify that the element text contains the given str. The match is case insensitive.

verifyTextEq

Source

Void verifyTextEq(Obj expected)

Verify that the given text matches the text of the element. The match is case insensitive.

xelems

Source

XElem[] xelems()

Return the underlying XElem objects