Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax with descriptive programming
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hi

Anyone able to offer some helpful advice as to why this object can't be found?

I need to be able to programmatically change the index, so it's quite important to be able to do something like this.

Thanks
Martin

Code:
Dim o
Set o = Browser("Browser").Page("Martin Short CanopiusORSA").Frame("Frame").Link("class:=link","text:=Lloyds Submission","color:=#5e1826","index:=5")
o.Click
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
How about check for the childobjects which are link and then find the link with the text=Lloyds Submission and find the index and supply it dynamically to create the object? or if you could find the childobject link which you intend simply click on it.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
Code:
Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("innertext:=Lloyds Submission")
instead of changing the index use innetext property of the link
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
Hi

Thanks for the reply.

As I understand it, both forms are acceptable. In fact I started off with your version. It's actually the index value that is the critical bit. I need more than one parameter, so tried

Code:
Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("innertext:=Lloyds Submission", "index:=2)

The aim is to parameterise the index id so that I can loop through the table and click all of the cells in a controlled manner. Each time I try, I can't get UFT to recognise the hyperlink object.

Thanks

Sorry Basanth, I responded to Vinod's reply and then realised that you had also responded.

I think your suggestion sounds good except that I don't know how to loop through the child objects. I tried experimenting with a FOR EACH LOOP, but UFT complained about my syntax.

If you could help here, I would be very grateful!

Martin
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
For Each element In group
[statements]
[Exit For]
[statements]
Next [element]
Reply
#6
Solved: 10 Years, 9 Months, 1 Week ago
Hi Vinod

So what should I use for "element" and what should I use for "group"?Once I know that, I think I can do this.

Cheers.
Reply
#7
Solved: 10 Years, 9 Months, 1 Week ago
Code:
dim names(2)

names(0)="happy"
names(1)="Sumit"
names(2)="Love"
For Each x in names
document.write(x & "
")
Next
Reply
#8
Solved: 10 Years, 9 Months, 1 Week ago
Hi Vinod

You've given me a general FOR EACH LOOP which is standard for any version of VB/VBS. I don't see how to apply this to my QTP problem.

Code:
Link("innertext:=Lloyds Submission", "index:=myInteger)
doesn't work, Basanth has suggested I loop through child objects where the type is "LINK" and I'm no closer to working out how to do this.

Thanks
Martin
Reply
#9
Solved: 10 Years, 9 Months, 1 Week ago
@martinshort

Try the below code. You will have to create a description object for link type. And inside the loop u will have to change the index property.

Code:
'Set parent object till the frame
Set oParent=Browser("Browser").Page("Martin Short CanopiusORSA").Frame("Frame")

'Create a description for link
Set objLinkDescription=Description.Create
objLinkDescription("micClass").value="Link"
objLinkDescription("name").value="Lloyds Submission"

'Get the total count
intCount=objLinkDescription.Count

'Run a loop from index 0 till the count
For intIndex=0 to intCount
    'assign index value at run time in loop
    objLinkDescription("index").value=intIndex
    'click on the link
    oParent.Link(objLinkDescription).Click
    msgbox "Click successful"
Next

'Release the object
Set objLinkDescription=Nothing

Let me know if you need more help.

Regards,
Ankesh
Reply
#10
Solved: 10 Years, 9 Months, 1 Week ago
Hi Ankesh

Really helpful. It took some fiddling to get it to recognise the number of rows. Your version kept telling me that there were only two items, but I got there in the end by identifying the table object and used the rowcount property on it.

Much appreciated.
Martin
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic descriptive Programming issue in Terminal Emulator cprasad 1 1,739 04-25-2019, 08:17 PM
Last Post: Ankur
  UFT Tool support with Descriptive programming laks 1 1,628 07-05-2018, 05:31 PM
Last Post: Ankur
  UFT Descriptive Programming objects not identified in a secure & private intranet env bugfinder2 1 1,660 06-07-2017, 01:41 PM
Last Post: Ankur
  UFT descriptive programming Browser("creationtime:=-1") not always working SOUMYADEEP 0 2,891 01-20-2017, 01:53 AM
Last Post: SOUMYADEEP
  Inserting variable values into Descriptive Programming Functions eske99 2 3,143 12-18-2015, 01:47 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)