a cool new way to retrieve Style Attributes easily

Java Programming Masterclass for Software Developers Course for as low as ₹ 420

I am sure, you must be knowing this by now. Just listing down this cool feature implemented in UFT 11.52 onwards. This is about retrieving style attributes of web objects runtime, for example retrieving background color, font, font color etc. All we used to do earlier is using objects property to retrieve such values. something like below


But now this has been made even more simplified to use in UFT. we directly use GetROProperty to retrieve the value or even use the property to identify the object. This method is called as Style/* Notation Web Object Identification and this process of object identification is called as Identification using Web Object Identifiers.

Web Object Identifiers can be used to limit the number of similar candidate objects to identify by using it before the regular object identification process. User does not specifically need to do any thing, this will be handled internally by UFT once you use any of the object identifier types.

Below are Web object Identifier types

CSS Web Object Identification – Using Properties defined in CSS.

User-Defined XPath Web Object Identification – Identification using defined XPath.

Automatic X-Path Web Object Identification – using UFT generate XPath property.

Attribute/* Notation Web Object Identification – using the attribute/* notation to access custom native properties of Web-based objects or events associated with Web-based objects

Style/* Notation Web Object Identification – using the style/* notation to access the values of CSS properties for a Web-based object.

In this post we are just discussing Style/* notation and how this simplifies our scripting.

using style/* notation, we can access the values of CSS properties for a web based objects . here is how to retrieve Value using GetROProperty using style/<property>.

to retrieve  properties of google button.

Print "Font Name: " & Browser("Google").Page("Google").WebButton("Google Search").GetROProperty("style/font-family")
Print "Font Size: " & Browser("Google").Page("Google").WebButton("Google Search").GetROProperty("style/font-size")
Print "Color : " & Browser("Google").Page("Google").WebButton("Google Search").GetROProperty("style/color")
Print "Background Color : " & Browser("Google").Page("Google").WebButton("Google Search").GetROProperty("style/background-color")

as mentioned earlier, we can identify and perform action using Style/*<property>

below example to click on the google button using background color property


You can find how easy is your scripts now, comparitively when we use CSS (DOM) to retireve style attributes. Here is the older method just for you to compare.

Set btn =Browser("Google").Page("Google").WebButton("Google Search").Object
Set btnStyle = btn.currentStyle
Print btnStyle.backgroundColor


  1. Hi Saket,

    how the Virtual object working, i created object and stored VOT but how expected object and actual object comparing runtime without support of OR .

    1) after prepare virtual object script my script is not executing why. kindly hep me.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.