Hi Surabhi,
U can follow both approaches. Either using OR/DP
Let me show you both methods:
Method 1: Using OR
I here assume that all the links are present on the same page.
msgbox = Browser("").Page("").link("").getroproperty("color")
repeat the same for all 10 links .This will return you a value in
hexadecimal value.
Compare the value and get the color of link.
for example 0000ff is the value for blue link.
Method 2:Using Descriptive Programming
Function ClickLink(LinkName)
Set oLink = Description.Create()
oLink("micclass").Value = "Link"
oLink("name").Value = LinkName
Set collection = browser("").page("").Childobjects(oLink)
For i = 0 to collection.count -1
ColorValue = collection(i).GetROProperty("color")
if StrComp(ColorValue,"ff0000") = 0 then
collection(i).Click
exit For
End If
next
End Function
I hope this helps.
Enjoy Automation
Shantanu
On Friday, 1 November 2013 00:43:05 UTC+5:30, surabhi wrote:
>
> Can anyone give me the sample code?
>
> I have 10 links names. I want to check the link font color for each link
> and if link color = red, then click on that.
>
> Thanks,
> surabhi
>
--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
---
You received this message because you are subscribed to the Google Groups "QTP
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.