Micro Focus QTP (UFT) Forums
How to validate color of image object in a web page - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to validate color of image object in a web page (/Thread-How-to-validate-color-of-image-object-in-a-web-page)



How to validate color of image object in a web page - qtplearner88 - 06-12-2012

Hi

I need to validate the color of some image objects inside a web page. We have red,green,yellow etc . These colors are pointing towards some live status. So it will come dynamically. I need to check which color is coming.

Please find the attachment.

Can anyone pls help me here? Thanks

Regards
Vivek


RE: How to validate color of image object in a web page - sshukla12 - 06-12-2012

Hi,

Try to use DOM..it will help u.

Regards,
Sankalp


RE: How to validate color of image object in a web page - qtplearner88 - 06-12-2012

Hi Sankalp,
I have no idea how to use DOM.. I have not done it before. Can you please help me.?

Regards
Vivek


RE: How to validate color of image object in a web page - sshukla12 - 06-12-2012

Hi,
I have 1 doubt, did these are images of different color or there is one object whose color will get changed as per status.

if color is changing then u can refer the below code:

Code:
Set ctrlWebEl = Browser("Welcome to Gmail").Page("Welcome to Gmail").WebElement("Welcome to Gmail")
Set objWebEl = ctrlWebEl.Object

sColor = objWebEl.currentStyle.color
'or u can use
sBackgrColor = objWebEl.currentStyle.backgroundColor

if these are different objects of different color then add these objects in OR with unique properties and use if conditions to identify which object is displayed and proceed further.

Regards,
Sankalp


RE: How to validate color of image object in a web page - qtplearner88 - 06-12-2012

Hi Sankalp,

Yes these are different objects of different color and these are present inside a webtable. And the rows of webtable will also change dynamically.

Thanks
Vivek


RE: How to validate color of image object in a web page - ssvali - 06-12-2012

It will be helpful if u provide snapshot of ur application


RE: How to validate color of image object in a web page - sshukla12 - 06-12-2012

Hi,

I think if these are different objects then add them in OR and proceed further using loops and conditions.

Let me know in case of any help required.

Regards,
Sankalp


RE: How to validate color of image object in a web page - qtplearner88 - 06-12-2012

Thanks a lot sankalp!!
I will try this and come back if I have any doubts


RE: How to validate color of image object in a web page - sshukla12 - 06-12-2012

Always there 2 help u out. Wink

Regards,
Sankalp


RE: How to validate color of image object in a web page - Shridevi.Salagare - 06-14-2012

Let me know if this works for you --
Sometimes when the object have color..Their runtime property text ..might have color in it -
e.g. Green color object might have runtime text Name_GRN

This had worked for me.