Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check color of a text box
#1
Solved: 10 Years, 9 Months ago
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]
Reply
#2
Solved: 10 Years, 9 Months ago
Have you checked with Object Spy?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 10 Years, 9 Months ago
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
Reply
#4
Solved: 10 Years, 9 Months ago
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.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#5
Solved: 10 Years, 9 Months ago
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
Reply
#6
Solved: 10 Years, 9 Months ago
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
Reply
#7
Solved: 10 Years, 9 Months ago
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.
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with Text color recognition Treirk 0 973 06-17-2019, 12:19 PM
Last Post: Treirk
  Getting background color of an object on mouse over Surya 2 3,713 06-27-2018, 08:51 PM
Last Post: vensas3181
  How can we get the Windows application Text box background color Using UFT 11.53 Kuppampattu 3 5,669 06-06-2017, 11:12 AM
Last Post: workrohit08
  SwfTreeview - Color validation for child item YogeshCallappa 0 2,060 11-10-2016, 04:55 PM
Last Post: YogeshCallappa
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,540 09-13-2015, 12:06 AM
Last Post: ADITI1992

Forum Jump:


Users browsing this thread: 1 Guest(s)