Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About GetToProperty
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hello friends...

Here I provided code to get the roproperty and toproperty for links in yahoo page, while running script I am getting small issue here is Run Error Showing
"The "Are you protected? " Link object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object." with Stop, Retry, Skip, Debug and Details buttons. If I press Skip it moves to next Link again I got a pop up "The "Create your sign-in seal. " Link object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object."
then I press skip, it identify links and provided results
If I change the Property it is working but not with outertext and text why?
Please explain why it is behaving like this and how to solve this?

'I added objects to OR here

Code:
'systemutil.run "www.yahoomail.com"

Dim links
Set links=description.Create
links("micclass").value="Link"

Set li=browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").ChildObjects(links)
print li.count

For i=0 to li.count-1
    roval=li(i).getroproperty("outertext")
    print roval
    wait(1)
    toval=browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").Link(roval).gettoproperty("outertext")
    print toval
Next
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
Hi Try the below function.... the concept is same as urs.....

Code:
Function clickonlink(slinkname)
set slink = Description.create()
slink("micclass").value = "Link"
set a = Browser("micclass:=Browser").page("micclass:=Page").childobjects(slink)
scount = a.count
for i = 1 to scount
slink = a(i).getroproperty("name")
if slinkname = slink then
a(i).click
exit for
end if
next
end Function

*** calling the Function***
Code:
clickonlink("Signup")

*** Let me know if u face any problem with this.... Smile
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago At 
'Make correction and one more thing this is not I asked, please give me correct answer for my question.

Code:
Function clickonlink(slinkname)
    set slink = Description.create()
    slink("micclass").value="Link"
    set a=Browser("micclass:=Browser").page("micclass:=Page").childobjects(slink)
    scount=a.count
        for i=0 to scount-1
            slink=a(i).getroproperty("innerText")
                if slinkname=slink then
                    a(i).click
                    exit for
                end if
        next
end Function

'*** calling the Function***

Code:
clickonlink("Learn more")
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
HI ,

Just use the "trim" function as shown below & now check it out.

Code:
roval=trim(li(i).getROproperty("outertext"))

I can assure that it would work.
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
Thank You Sreekanth, But

My Exact Question is about GetToProperty...

While Executing the Script QTP fail to get the value of Test Object Property.

error is :"The "Are you protected? " Link object was not found in the Object Repository.

Actually This is Available in OR, then why QTP is fail to get the value of outertext property for this link and one more in my question.

Please explain clearly

thanks & regards
Baba Fakruddin.D
Reply
#6
Solved: 10 Years, 9 Months, 1 Week ago
Hi ,

The below code is working for me.......I am not getting any errors as u said.......

Infact the length of roval(len(roval)) is not equal to the length of toval(len(toval)) .....(it seems roval is taking extra blank space , hence i have used "trim" while retrieving roval....So its fine now .....as below code )


Code :

Code:
'systemutil.run "www.yahoomail.com"

Dim links
Set links=description.Create
links("micclass").value="Link"

Set li=browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").ChildObjects(links)
print li.count

For i=0 to li.count-1
roval=trim(li(i).getroproperty("outertext"))
print roval
wait(1)
toval=browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").Link(roval).gettoproperty("outertext")
print toval
Next
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)