VivoQuant
Public Member Functions | List of all members
ScriptableWebElement Class Reference

An object to manage html elements of a WebECRF form. More...

Public Member Functions

void appendInsideHTML (string html)
 Appends the given html inside the element. More...
 
void appendOutsideHTML (string html)
 Appends the given html outside the element. More...
 
void setAttribute (string key, string value)
 Sets an attribute value. More...
 
void setProperty (string propertyName, string value)
 Sets a property value. More...
 
void addClass (string className)
 Adds a class to an element. More...
 
void setPlainText (string text)
 Set and element with the given plain text. More...
 
bool hasAttribute (string key)
 Check if an element has the given attribute key. More...
 
string getAttribute (string key, string defaultVal=string())
 Gets a given attribute value. More...
 
string toString ()
 Gets the element as a string. More...
 
string tagName ()
 Gets the tag name of the element. More...
 
Array< string > classes ()
 Gets the list of classes contained in the element. More...
 
string plainText ()
 Gets the element as plain text. More...
 
void evalJavaScript (string js)
 Evaluate JavaScript on the element.
 

Detailed Description

An object to manage html elements of a WebECRF form.

It provides functions to access the element's HTML directly or access the attributes of the element.

See also WebECRF::getElement() or WebECRF::getAllElement() to obtain this object.

Member Function Documentation

◆ addClass()

void addClass ( string  className)

Adds a class to an element.

Parameters
classNameThe class name to add

◆ appendInsideHTML()

void appendInsideHTML ( string  html)

Appends the given html inside the element.

Parameters
htmlThe html to append

◆ appendOutsideHTML()

void appendOutsideHTML ( string  html)

Appends the given html outside the element.

Parameters
htmlThe html to append

◆ classes()

Array<string> classes ( )

Gets the list of classes contained in the element.

Returns
An array of string with the class names

◆ getAttribute()

string getAttribute ( string  key,
string  defaultVal = string() 
)

Gets a given attribute value.

Parameters
keyThe given attribute key
defaultValThe default attribute value if it doesn't exist
Returns
The attribute value

◆ hasAttribute()

bool hasAttribute ( string  key)

Check if an element has the given attribute key.

Parameters
keyThe given attribute key
Returns
True if the attribute exists, false otherwise

◆ plainText()

string plainText ( )

Gets the element as plain text.

Returns
A string containing the plain text

◆ setAttribute()

void setAttribute ( string  key,
string  value 
)

Sets an attribute value.

Parameters
keyThe attribute key
valueThe new attribute value
Returns
The attribute value

◆ setPlainText()

void setPlainText ( string  text)

Set and element with the given plain text.

Parameters
textThe given plain text

◆ setProperty()

void setProperty ( string  propertyName,
string  value 
)

Sets a property value.

Parameters
propertyNameThe property name
valueThe new property value
Returns
The property value
Note
Property and attribute can are not map 1:1 and can have different values. For a persistent "value", this method should be used.

◆ tagName()

string tagName ( )

Gets the tag name of the element.

Returns
The tag name

◆ toString()

string toString ( )

Gets the element as a string.

Returns
The element as a string