0 Shares 2009 Views 2 Comments

a cool new way to retrieve Style Attributes easily

Oct 19, 2014
2009 Views 2

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

You may be interested

UFT Patch Updates – UFT 14.03
Unified Functional Testing
1436 views1
Unified Functional Testing
1436 views1

UFT Patch Updates – UFT 14.03

Saket - Mar 11, 2018

Post the launch of UFT 14.0, there are three patch updates has been released including a number of features and enhancement. Recently Micro Focus unveiled third patch…

Setting up Web Service Automation Project
Katalon Studio
Katalon Studio

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
1081 views1
Katalon Studio
1081 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…


  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.


Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Email Address
Secure and Spam free...