Micro Focus QTP (UFT) Forums
How to check color of a text box - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to check color of a text box (/Thread-How-to-check-color-of-a-text-box)



How to check color of a text box - Pallavi - 09-27-2008

Hi All,

I am new to QTP. In our application all mandatory fields are in yellow color. We need to check whether the fields are mandatory, by checking the Field's color. I could not find any color property to check the color. If there is any way to check the color, please let me know.


Thanks,
Pallavi [/color]


RE: How to check color of a text box - Ankur - 09-27-2008

Have you checked with Object Spy?


RE: How to check color of a text box - Pallavi - 09-29-2008

Yes Ankur, i checked with object spy. The property to check the color is not listed in the properties list. Please let me know if there is any way to check the color.

Thanks & Regards,
Pallavi


RE: How to check color of a text box - Ankur - 09-29-2008

Can u attach the screen shot here for all the RO properties of the yellow field? Otherwise use DOM to access the color of the object.


RE: How to check color of a text box - kiran_sweng - 10-02-2008

Hi Pallavi,

As per my experience, you can use "File name" property of the image control. In case text box recongnized as image , you will find file name property associated with it. Use "file name" property and verify its value in runtime. You can't verify the color of image by red or blue or yellow. You will have file name property which has "green.gif" (example) as value.

Above all , it depends how it was designed. As Ankur requested , please attach screenshot. I will see let know further ...

Thanks,
Kiran


RE: How to check color of a text box - venkatbatchu - 07-28-2009

Hi Pallavi,
with the "outerhtml" property u would able to identify which colour it is
here i am exaplaining you with the mandatory field as a red colour then .getrowproperty("outerhtml") then this value would be <FONT color=#cc0000>Textarea</FONT> then split this value in to your convinent way and validate with this
If color=#cc0000 then reporter.reportevent ,,,,,,
Try this once and let me know


RE: How to check color of a text box - supputuri - 07-28-2009

Hi All,

Please find the below LOC which will clear idea on how to work with the color and fonts.
(Copy and paste the code in QTP and Run)
-----------------------------------------------------------------------------------------
'Here is the simple piece of code to check the color,font,bgcolor,font-family.
Code:
Set wsh=CreateObject("WScript.Shell")
Dim lnkobj
If Browser("name:=Google").Page("title:=Google").Exist = False Then
    SystemUtil.Run "C:\Program Files\Internet Explorer\IExplore.exe","http://www.google.com/"
End If
Set lnkobj =Browser("name:=Google").Page("title:=Google").Link("name:=Hindi").Object.currentStyle
wsh.popup "Link BackGround Color ="& lnkobj.backgroundColor,2,"Link BackGround Color"
wsh.popup "Link font size ="& lnkobj.fontsize,2,"Link font size"
wsh.popup "Link font family ="& lnkobj.fontfamily,2,"Link font family"
wsh.popup "Link font color ="& lnkobj.color,2,"Link font color "
wsh.popup "Link text alignment ="& lnkobj.textalign,2,"Link text alignment "
Set lnkobj=Nothing
Browser("name:=Google").Close
--------------------------------------------------------------------------------------------

Please let me know if any one have any queries.