Skip to content

HTMLObject

This object contains actions and properties for DOM elements of Web page.

Extends SeSSimulatedObject

Behavior Pattern: HTMLSeleniumBehavior

Property Summary

Property Description Getter Setter
Alt Alt of the element. GetAlt
Checked 'Checked' state of the element. GetChecked
Class Class of the element. GetClass
ClientX X-coordinate of the top left corner of the element relative to browser window. GetClientX
ClientY Y-coordinate of the top left corner of the element relative to browser window. GetClientY
ComputedStyle Gets the value of a given CSS property of an element, after applying active stylesheets and resolving any basic computation this value may contain. GetComputedStyle
Enabled 'Enabled' state of the element. GetEnabled SetEnabled
Height Height of the element. GetHeight
Href HREF of the element. GetHref
Id ID of the element. GetId
InnerText Inner text of the element. GetInnerText
Label Label of the element. GetLabel
Name Name of the element. GetName
NodeText Text of the element without children. GetNodeText
PageTitle Title of the HTML document. GetPageTitle
PageURL Location URL of the HTML document. GetPageURL
Style Style of the element. GetStyle
Tag Tag of the element. GetTag
Text Text of the element with normalized spaces. GetText
Title Title of the element. GetTitle
Value Value of the element. GetValue SetValue
Visible Returns true if the element is visible on screen. GetVisible
Width Width of the element. GetWidth
X X-coordinate of the top left corner of the element. GetX
XPath XPath of the element. GetXPath
Y Y-coordinate of the top left corner of the element. GetY

Action Summary

Action Description
DoAddSelection Adds selection of the specified option in the multi-select element.
DoClick Clicks on HTML element (button, link).
DoDblClick Double-Clicks on HTML element (button, link).
DoDOMChildAt Returns n-th child (zero-based).
DoDOMChildrenCount Returns number of children elements for this one.
DoDOMConvert Creates a clone of this object converted to a requested type.
DoDOMFindParentWithAttribute Returns parent element (if any) with given attribute matching given string or 'regex:.
DoDOMGetAttribute Returns specified attribute.
DoDOMGetAttributes Returns all attributes of a node.
DoDOMNextSibling Returns next sibling element for this one.
DoDOMParent Returns parent element having this element.
DoDOMPrevSibling Return previous sibling element for this one.
DoDOMQueryCss Gets array of elements matching CSS selector on this object.
DoDOMQueryValue Executes an xpath query that may return a value of string, number or boolean type.
DoDOMQueryXPath Gets array of elements matching XPath query on this object.
DoDOMRoot Returns Root element having this element.
DoEnsureVisible Makes sure specified element is visible on the screen.
DoGetRect Finds screen rectangle for this object.
DoGetSelection Gets selected options text of a SELECT element.
DoLClick Directly invokes the click method on the HTML element.
DoMouseMove Moves mouse on HTML element with offset.
DoRClick Right-clicks on the HTML element.
DoRemoveSelection Deselects the specified option in the multi-select element.
DoSelect Selects the specified element in <select> control.
DoSendKeys Keys to send.
DoSetCheck Sets specified state of check box.
DoSetText Sets text for input edit or textarea.

Property Detail

Alt

Alt of the element.

Type: string

Accessors: GetAlt

value = SeS('SomeHTMLObject').GetAlt()

Checked

'Checked' state of the element.

Type: boolean

Accessors: GetChecked

value = SeS('SomeHTMLObject').GetChecked()

Class

Class of the element.

Type: string

Accessors: GetClass

value = SeS('SomeHTMLObject').GetClass()

ClientX

X-coordinate of the top left corner of the element relative to browser window.

Type: number

Accessors: GetClientX

value = SeS('SomeHTMLObject').GetClientX()

ClientY

Y-coordinate of the top left corner of the element relative to browser window.

Type: number

Accessors: GetClientY

value = SeS('SomeHTMLObject').GetClientY()

ComputedStyle

Gets the value of a given CSS property of an element, after applying active stylesheets and resolving any basic computation this value may contain.

Getter Parameters:

Name Type Description
optFieldName string CSS property name.

Type: string

Accessors: GetComputedStyle

value = SeS('SomeHTMLObject').GetComputedStyle(/**string*/optFieldName)

Enabled

'Enabled' state of the element.

Type: boolean

Accessors: GetEnabled, SetEnabled

value = SeS('SomeHTMLObject').GetEnabled()

SeS('SomeHTMLObject').SetEnabled(value)

Height

Height of the element.

Type: number

Accessors: GetHeight

value = SeS('SomeHTMLObject').GetHeight()

Href

HREF of the element.

Type: string

Accessors: GetHref

value = SeS('SomeHTMLObject').GetHref()

Id

ID of the element.

Type: string

Accessors: GetId

value = SeS('SomeHTMLObject').GetId()

InnerText

Inner text of the element.

Type: string

Accessors: GetInnerText

value = SeS('SomeHTMLObject').GetInnerText()

Label

Label of the element.

Type: string

Accessors: GetLabel

value = SeS('SomeHTMLObject').GetLabel()

Name

Name of the element.

Type: string

Accessors: GetName

value = SeS('SomeHTMLObject').GetName()

NodeText

Text of the element without children.

Type: string

Accessors: GetNodeText

value = SeS('SomeHTMLObject').GetNodeText()

PageTitle

Title of the HTML document.

Type: string

Accessors: GetPageTitle

value = SeS('SomeHTMLObject').GetPageTitle()

PageURL

Location URL of the HTML document.

Type: string

Accessors: GetPageURL

value = SeS('SomeHTMLObject').GetPageURL()

Style

Style of the element.

Type: string

Accessors: GetStyle

value = SeS('SomeHTMLObject').GetStyle()

Tag

Tag of the element.

Type: string

Accessors: GetTag

value = SeS('SomeHTMLObject').GetTag()

Text

Text of the element with normalized spaces.

Type: string

Accessors: GetText

value = SeS('SomeHTMLObject').GetText()

Title

Title of the element.

Type: string

Accessors: GetTitle

value = SeS('SomeHTMLObject').GetTitle()

Value

Value of the element.

Type: string

Accessors: GetValue, SetValue

value = SeS('SomeHTMLObject').GetValue()

SeS('SomeHTMLObject').SetValue(value)

Visible

Returns true if the element is visible on screen. Requires Rapise 6.6+

Type: boolean

Accessors: GetVisible

value = SeS('SomeHTMLObject').GetVisible()

Width

Width of the element.

Type: number

Accessors: GetWidth

value = SeS('SomeHTMLObject').GetWidth()

X

X-coordinate of the top left corner of the element.

Type: number

Accessors: GetX

value = SeS('SomeHTMLObject').GetX()

XPath

XPath of the element.

Type: string

Accessors: GetXPath

value = SeS('SomeHTMLObject').GetXPath()

Y

Y-coordinate of the top left corner of the element.

Type: number

Accessors: GetY

value = SeS('SomeHTMLObject').GetY()

Action Detail

DoAddSelection

Adds selection of the specified option in the multi-select element.

SeS('SomeHTMLObject').DoAddSelection(optionText)

Parameters:

Name Type Description
optionText string Element to add to selection

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoClick

Clicks on HTML element (button, link).

SeS('SomeHTMLObject').DoClick(x, y, forceEvent)

Parameters:

Name Type Description
x number X offset to click within object. Calculated from the top-left corner. Default is a center. Floating point in the range (-2, 2) means percentage of the width.
Optional.
y number Y offset to click within object. Calculated from the top-left corner. Default is a center. Floating point in the range (-2, 2) means percentage of the height.
Optional.
forceEvent boolean Pass 'true' to force browser event without actual mouse click
Optional, Default: "false".

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoDblClick

Double-Clicks on HTML element (button, link).

SeS('SomeHTMLObject').DoDblClick()

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoDOMChildAt

Returns n-th child (zero-based).

SeS('SomeHTMLObject').DoDOMChildAt(n)

Parameters:

Name Type Description
n number n Index of the child element.

Returns:

HTMLObject: n-th child.

DoDOMChildrenCount

Returns number of children elements for this one.

SeS('SomeHTMLObject').DoDOMChildrenCount()

Returns:

number: Number of children elements.

DoDOMConvert

Creates a clone of this object converted to a requested type.

SeS('SomeHTMLObject').DoDOMConvert(type)

Parameters:

Name Type Description
type string Type of an object.

Returns:

HTMLObject: New Object of requested type or HTMLObject if type not found, null if error occur.

DoDOMFindParentWithAttribute

Returns parent element (if any) with given attribute matching given string or 'regex:...' expression.

SeS('SomeHTMLObject').DoDOMFindParentWithAttribute(attrName, match)

Parameters:

Name Type Description
attrName string Name of an attribute.
match string Match string.

Returns:

HTMLObject: Matched element or 'null'.

DoDOMGetAttribute

Returns specified attribute.

SeS('SomeHTMLObject').DoDOMGetAttribute(attrName)

Parameters:

Name Type Description
attrName string Name of an attribute.

Returns:

object: Attribute value.

DoDOMGetAttributes

Returns all attributes of a node.

SeS('SomeHTMLObject').DoDOMGetAttributes()

Returns:

array: Array of attributes.

DoDOMNextSibling

Returns next sibling element for this one.

SeS('SomeHTMLObject').DoDOMNextSibling()

Returns:

HTMLObject: Next sibling element.

DoDOMParent

Returns parent element having this element.

SeS('SomeHTMLObject').DoDOMParent()

Returns:

HTMLObject: Parent element.

DoDOMPrevSibling

Return previous sibling element for this one.

SeS('SomeHTMLObject').DoDOMPrevSibling()

Returns:

HTMLObject: Previous sibling element.

DoDOMQueryCss

Gets array of elements matching CSS selector on this object.

SeS('SomeHTMLObject').DoDOMQueryCss(css)

Parameters:

Name Type Description
css string CSS selector.

Returns:

array: Array of matched elements.

DoDOMQueryValue

Executes an xpath query that may return a value of string, number or boolean type. If the result of the query is an array of nodes - a combined string is returned (;-separated text values of nodes). If the query returns nothing (invalid query or nothing matches) then null is returned. Requires Rapise 6.4+

SeS('SomeHTMLObject').DoDOMQueryValue(xpath)

Parameters:

Name Type Description
xpath string Absolute or relative xpath query. e.g. count(//div), //a[1]/@href='/Home', ./li/text()

Returns:

string |
number |
boolean: Result of the query or null if the query is invalid.

DoDOMQueryXPath

Gets array of elements matching XPath query on this object.

SeS('SomeHTMLObject').DoDOMQueryXPath(xpath)

Parameters:

Name Type Description
xpath string Xpath query.

Returns:

array: Array of matched elements.

DoDOMRoot

Returns Root element having this element.

SeS('SomeHTMLObject').DoDOMRoot()

Returns:

HTMLObject: Root element having this element.

DoEnsureVisible

Makes sure specified element is visible on the screen.

SeS('SomeHTMLObject').DoEnsureVisible(vAlign, hAlign)

Parameters:

Name Type Description
vAlign string One of "start", "center", "end", or "nearest". Defaults to "start".
Optional.
hAlign string One of "start", "center", "end", or "nearest". Defaults to "nearest".
Optional.

Returns:

object: Rectangle of the element if it became visible, 'null' otherwise.

DoGetRect

Finds screen rectangle for this object.

SeS('SomeHTMLObject').DoGetRect()

Returns:

object: object {x, y, w, h}

DoGetSelection

Gets selected options text of a SELECT element. Example: 'Option1,Option2'.

SeS('SomeHTMLObject').DoGetSelection(delim)

Parameters:

Name Type Description
delim string Separator between options.
Optional, Default: ",".

Returns:

boolean: String with option values separated by delim.

DoLClick

Directly invokes the click method on the HTML element.

SeS('SomeHTMLObject').DoLClick(x, y)

Parameters:

Name Type Description
x number X offset to click within object. Calculated from the top-left corner. Default is a center. Floating point in the range (-2, 2) means percentage of the width.
Optional.
y number Y offset to click within object. Calculated from the top-left corner. Default is a center. Floating point in the range (-2, 2) means percentage of the height.
Optional.

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoMouseMove

Moves mouse on HTML element with offset.

SeS('SomeHTMLObject').DoMouseMove(x, y)

Parameters:

Name Type Description
x number X offset to click within object. Calculated from the top-left corner. Default is a center. Floating point in the range (-2, 2) means percentage of the width.
Optional.
y number Y offset to click within object. Calculated from the top-left corner. Default is a center. Floating point in the range (-2, 2) means percentage of the height.
Optional.

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoRClick

Right-clicks on the HTML element.

SeS('SomeHTMLObject').DoRClick()

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoRemoveSelection

Deselects the specified option in the multi-select element.

SeS('SomeHTMLObject').DoRemoveSelection(optionText)

Parameters:

Name Type Description
optionText string Element to remove from selection

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoSelect

Selects the specified element in <select> control. Since Rapise 6.3 also supports OL and UL lists.

SeS('SomeHTMLObject').DoSelect(txt)

Parameters:

Name Type Description
txt string Element to select

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoSendKeys

Keys to send. Supports patterns like in Global.DoSendKeys.

SeS('SomeHTMLObject').DoSendKeys(txt)

Parameters:

Name Type Description
txt string A sequence of keystrokes.

DoSetCheck

Sets specified state of check box.

SeS('SomeHTMLObject').DoSetCheck(state)

Parameters:

Name Type Description
state boolean State to set

Returns:

boolean: 'true' if successful, 'false' otherwise'

DoSetText

Sets text for input edit or textarea.

SeS('SomeHTMLObject').DoSetText(txt)

Parameters:

Name Type Description
txt string Text to set

Returns:

boolean: 'true' if successful, 'false' otherwise'