Legacy | UFT Function Reference: MWebElement

Performs different actions with a web element, such as clicking, setting the text, and retrieving the specified element property.

Locating the Element Identifier

Use the Legacy | Perfecto IDE object locator to generate a unique element identifier, assigned as the Element Identifier.

The Xpath is automatically generated as the element identifier. If the object has an ID, the Xpath will be based on the ID; otherwise, the full path in the tree is used.

Other identification methods (HTML id, HTML name, HTML class, HTML tag, text, or partial text) may be used. These values must be entered.

Properties

The built-in MWebElement properties that can be retrieved from the MWebElement include:

  • web_view
  • identifier
  • y
  • x
  • width
  • visibility
  • type
  • text
  • report_image_resolution
  • name
  • inputtype
  • id
  • htmltag
  • height
  • fontstyle
  • fontsize
  • fontfamily
  • fgcolor
  • class
  • by
  • bgcolor
Note:

When trying to retrieve information using a property not listed here, it will be recorded as GetControlProperty.

Functions

Name Arguments Description
Click Timeout Clicks on a control by calling the control API.
GetControlProperty Property
Timeout
Retrieves the text value of a webpage control.
Set Text
Timeout
Sets the control text, by calling the control set text API.
Set Secure Timeout Receives an encrypted string, decrypts it and sets the control text, by calling the control set text API.
Exists Timeout Checks is the object exists and returns string of "True" or "False" Timeout is optional.
Additional UFT functions

Examples

UFT Mobile Code Syntax Description
Device("DUT").MWebElement("MWebElement").Click On the device under test (DUT), clicks on a web element.
Device("DUT").MWebElement("MWebElement").Set "Perfecto Mobile" On the DUT, sets the text of a web element to "Perfecto Mobile"
Device("DUT").MWebElement("MWebElement").GetROProperty "text" On the DUT, retrieves the text value of the edit field property from the MWebElement object
Device("DUT").MWebElement("MWebElement").Exists(8) On the DUT, checks if an object exists with a timeout.