HTML_Object Class

This is the ultimate base class used for all objects that are HTML elements. The functions and properties defined in this class are available for all objects which are returned from the Object findObject(objectName) function.

ScreenRect HTML_Object.boundingClientRect

This read-only property holds the object's rectangle, with the position relative to the web view areas top left corner. The returned object has 4 properties: x and width holding the horizontal position and size and y and height holding the vertical position and size.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

String HTML_Object.className()

This function returns the subclass name of the HTML object; for example, HTML_Button Class. (See also, HTML_Object.domClassName.)

HTML_Object.click()

HTML_Object.click(modifierState)

HTML_Object.click(modifierState, x)

HTML_Object.click(modifierState, x, y)

HTML_Object.click(modifierState, x, y, button)

Clicks this HTML object as if the user had clicked it. All the arguments are optional. See Web Object API Function Parameters for which values are valid for the modifierState. The x and y are the object-relative coordindates of the click. The button must be one of 1 (left button), 2 (right button), or 4 (middle button).

HTML_Object.css

This read-only property provides access to the various CSS attributes that a HTML object may have. The attributes are modeled as sub properties of the css object so they can be accessed directly individually or all of them retrieved through the KeyValueMap object.properties(object) function.

Some CSS attribute names are problematic in script languages, for example background-color. In order to mitigate this problem Squish exposes such properties by removing the dash and turning the following letter to upper case. So the background-color CSS attribute is accessible using the backgroundColor name in the CSS properties object.

The values of the individual CSS attributes are being modeled as strings, except for CSS attributes that provide color information (backgroundColor, color). These color related attributes are modeled using the CssColor Type type.

Here is an example of verifying an object's background color:

blue_title = waitForObject(blue_title_H1)
expectedColor = CssColor.fromRgb(20, 20, 200)
test.compare(blue_title.css.backgroundColor, expectedColor)
var blue_title = waitForObject(blue_title_H1)
var expectedColor = CssColor.fromRgb(20, 20, 200)
test.compare(blue_title.css.backgroundColor, expectedColor)
my $blue_title = waitForObject(blue_title_H1)
my $expectedColor = CssColor::fromRgb(20, 20, 200)
test->compare(blue_title->css->backgroundColor, expectedColor)
blue_title = waitForObject(blue_title_H1)
expectedColor = CssColor.fromRgb(20, 20, 200)
Test::compare(blue_title.css.backgroundColor, expectedColor)
set blue_title [waitForObject blue_title_H1]
set expectedColor [invoke CssColor fromRgb 20 20 200]
set css_props [property get blue_title css]
test compare [property get css_props backgroundColor] expectedColor

String HTML_Object.domClassName

This read-only property holds the object's class name that is used by the DOM.

This is a synthetic property, but it can be used in multi property names under a different name. See Synthetic Properties in Web Objects for more information on synthetic properties and String HTML_Object.className() for how to use it in multi property names.

String HTML_Object.domPath

This read-only property holds the object's path in the DOM tree. The value of this property can be used as a hierarchical name identifying the object. Note that the domPath is not stable towards changes in the structure of the website.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

HTML_Object.doubleClick()

HTML_Object.doubleClick(modifierState)

HTML_Object.doubleClick(modifierState, x)

HTML_Object.doubleClick(modifierState, x, y)

Executes a double click on this HTML object as if the user had double clicked it. All the arguments are optional. See Web Object API Function Parameters for which values are valid for the modifierState. The x and y are the object-relative coordindates of the double click.

HTML_XPathResult HTML_Object.evaluateXPath(statement)

Evaluates the XPath statement and returns an HTML_XPathResult Class object. The XPath statement is executed relative to this HTML_Object's XPath.

This method makes it possible to efficiently operate on a web application's DOM document, for example, to retrieve elements and access their properties.

See also How to Use XPath.

HTML_Object HTML_Object.firstChild()

This function returns the object's first child (as an HTML_Object), or an invalid object if the object has no children. (See also, HTML_Object HTML_Object.lastChild(), HTML_Object HTML_Object.nextSibling(), HTML_Object.numChildren, HTML_Object HTML_Object.parentElement(), and HTML_Object HTML_Object.previousSibling().)

bool HTML_Object.hasFocus

This read-only property indicates if the given object has keyboard focus within the document. This is usually only meaningful for text fields.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

int HTML_Object.height

This read-only property holds the object's height. (See also, HTML_Object.width.)

Note: This property is deprecated as the value may not be calculated correctly for all browsers. Consider using the height of the rectangle provided by the HTML_Object.boundingClientRect instead.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

String HTML_Object.hierarchicalQualifiedName()

This function returns this object's hierarchical, qualified name.

Object HTML_Object.id

This read-only property holds the object's ID.

String HTML_Object.innerHTML

This read-only property holds the object's inner text—this might contain HTML markup. (See also, HTML_Object.innerText and HTML_Object.simplifiedInnerText.)

String HTML_Object.innerText

This read-only property holds the object's inner text as plain text, so the returned string does not contain any HTML markup. (See also, HTML_Object.innerHTML and HTML_Object.simplifiedInnerText.)

HTML_Object HTML_Object.shadowRoot

This read-only property provides access to the shadow root node of the given object, if there is any. The property returns a HTML_Object instance which can be used to access children inside the Shadow DOM.

This property will only return a shadow root object if the element has a shadow root node attached to it and the shadow root has been created in open mode. See Mozilla Shadow DOM documentation for more details on Shadow DOM.

In order to navigate from the shadow root back to the containing element please use HTML_Object.parentElement().

String HTML_Object.simplifiedInnerText

This read-only property holds the object's inner text as plain text, so the returned string does not contain any HTML markup. In addition the whitespace is simplified, so that only a single space is kept for any number of whitespace. In this context newlines, tabulators and linebreaks are also considered to be whitespace so those are replaced with a single space as well. (See also, HTML_Object.innerHTML and HTML_Object.innerText.)

This is a synthetic property, but it can be used in multi property names. See Synthetic Properties in Web Objects for more information on synthetic properties.

HTML_Object.invoke(methodName)

HTML_Object.invoke(methodName, argument1)

HTML_Object.invoke(methodName, argument1, argument2)

Invokes an HTML_Object method called methodName, and returns the value returned by the method call as a string. Both the argument1 and argument2 arguments are optional. If either or both are given it or they are passed as argument(s) to the method call.

HTML_Object HTML_Object.lastChild()

This function returns the object's last child (as an HTML_Object), or an invalid object if the object has no children. (See also, HTML_Object HTML_Object.firstChild(), HTML_Object HTML_Object.nextSibling(), HTML_Object.numChildren, HTML_Object HTML_Object.parentElement(), and HTML_Object HTML_Object.previousSibling().)

String HTML_Object.name()

This function returns this object's internal JavaScript reference name.

HTML_Object HTML_Object.nextSibling()

This function returns the object's next sibling (as an HTML_Object), or an invalid object if the object has no following sibling. (See also, HTML_Object HTML_Object.firstChild(), HTML_Object HTML_Object.lastChild(), HTML_Object.numChildren, HTML_Object HTML_Object.parentElement(), and HTML_Object HTML_Object.previousSibling().)

int HTML_Object.numChildren

This read-only property holds how many children this object has—this could be 0. (See also, HTML_Object HTML_Object.firstChild(), HTML_Object HTML_Object.lastChild(), HTML_Object HTML_Object.nextSibling(), HTML_Object HTML_Object.parentElement(), and HTML_Object HTML_Object.previousSibling().)

HTML_Object.openContextMenu()

Clicks a HTML object the same way a user would to open a context menu for that object.

HTML_Object HTML_Object.parentElement()

This function returns the object's parent object (as an HTML_Object), or an invalid object, if this object has no parent. Note that only a web site's document node has no parent; all other nodes are children of the document or of other nodes within the document. (See also, HTML_Object HTML_Object.firstChild(), HTML_Object HTML_Object.lastChild(), HTML_Object HTML_Object.nextSibling(), HTML_Object.numChildren, and HTML_Object HTML_Object.previousSibling().)

HTML_Object HTML_Object.previousSibling()

This function returns the object's previous sibling (as an HTML_Object), or an invalid object if the object has no preceding sibling. (See also, HTML_Object HTML_Object.firstChild(), HTML_Object HTML_Object.lastChild(), HTML_Object HTML_Object.nextSibling(), HTML_Object.numChildren, and HTML_Object HTML_Object.parentElement().)

String HTML_Object.property(name)

This function returns the value of the property called name as a string. (The returned value is always a string even if the property was set to an integer or Boolean.) (See also, HTML_Object.setProperty(name, value).)

ScreenRect HTML_Object.screenRect

This read-only property holds the object's rectangle, with the position relative to the top left corner of the desktop screen. The returned object has 4 properties: x and width holding the horizontal position and size and y and height holding the vertical position and size.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

HTML_Object.scrollTo(top)

The function scrolls the web content to make the object visible for which it is called. The optional top can be used to indicate whether the object should appear at the top or bottom of the web content. Passing true (the default if no argument is given) aligns it to the top, passing false aligns it to the bottom. (This function is internally called by the global scrollTo(objectOrName, top) function.)

HTML_Object.setProperty(name, value)

Sets the property called name's value to value. The value may be a string, integer, or Boolean. (See also, String HTML_Object.property(name).)

HTML_Style HTML_Object.style()

This function returns an HTML_Style Class object that can be used to query this object's CSS (Cascading Style Sheet) attributes.

String HTML_Object.styleDisplay

This read-only property holds the object's style.display value.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

String HTML_Object.styleVisibility()

This function returns the object's style.visibility value.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

String HTML_Object.tagName

This read-only property holds the object's HTML tag name, for example, DIV or INPUT.

String HTML_Object.title

This read-only property holds the object's title.

Boolean HTML_Object.visible

This read-only property holds true if the object is visible according to the CSS rules applied to it. If the object's 'visibility' CSS attribute is set to hidden or if the object's or any parent's 'display' CSS attribute is set to none, this property holds false.

This is a synthetic property, but it can be used in multi property names. See Synthetic Properties in Web Objects for more information on synthetic properties.

Note: In older Squish releases, this property had a different meaning that reflected the value of a visible attribute on the object instead of reflecting the object's visibility according to CSS. This behavior can be restored by setting the BackwardsCompatibleVisiblePropertyForHTML_Object setting in the file etc/webwrapper.ini to true.

int HTML_Object.width

This read-only property holds the object's width. See also, HTML_Object.height.

Note: This property is deprecated as the value may not be calculated correctly for all browsers. Consider using the width of the rectangle provided by the HTML_Object.boundingClientRect instead.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

int HTML_Object.x

This read-only property holds the object's x-coordinate.

Note: This property is deprecated as the value may not be calculated correctly for all browsers. Consider using the y property of the rectangle provided by the HTML_Object.boundingClientRect or HTML_Object.screenRect instead.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

int HTML_Object.y

This read-only property holds the object's y-coordinate.

Note: This property is deprecated as the value may not be calculated correctly for all browsers. Consider using the x property of the rectangle provided by the HTML_Object.boundingClientRect or HTML_Object.screenRect instead.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results