Syntax with descriptive programming - 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: Syntax with descriptive programming (/Thread-Syntax-with-descriptive-programming) |
Syntax with descriptive programming - martinshort - 05-14-2013 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 RE: Syntax with descriptive programming - basanth27 - 05-15-2013 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. RE: Syntax with descriptive programming - vinod123 - 05-15-2013 Code: Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("innertext:=Lloyds Submission") RE: Syntax with descriptive programming - martinshort - 05-15-2013 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 RE: Syntax with descriptive programming - vinod123 - 05-15-2013 For Each element In group [statements] [Exit For] [statements] Next [element] RE: Syntax with descriptive programming - martinshort - 05-15-2013 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. RE: Syntax with descriptive programming - vinod123 - 05-15-2013 Code: dim names(2) RE: Syntax with descriptive programming - martinshort - 05-15-2013 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) Thanks Martin RE: Syntax with descriptive programming - Ankesh - 05-15-2013 @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 Let me know if you need more help. Regards, Ankesh RE: Syntax with descriptive programming - martinshort - 05-15-2013 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 |