Micro Focus QTP (UFT) Forums
Using looping method to test selection of many records - 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: Using looping method to test selection of many records (/Thread-Using-looping-method-to-test-selection-of-many-records)



Using looping method to test selection of many records - mahadevan.swamy - 09-29-2008

Hi,
I am given the following problem. I have a list of invoices in the application and I have to make sure the every invoice I click, should display some details. I have thought of looping the script but sometimes that doesn't work.

For example, I have a manual generated script here

Code:
Browser("UWindsor").Page("ENG").Frame("_sweview_2").Image("Select record").Click
Browser("UWindsor").Page("ENG”).Frame("_sweview_3").Link("Line Items").Click
Browser("UWindsor").Page("ENG").Frame("_swescrnbar").Link("Invoices").Click
'Browser("UWindsor").Page("ENG").Frame("_sweview_4").Image("Select record").Click
'Browser("UWindsor").Page("ENG").Frame("_sweview_5").Link("Line Items").Click
'Browser("UWindsor").Page("ENG").Frame("_swescrnbar").Link("Invoices").Click
'Browser("UWindsor").Page("ENG").Frame("_sweview_6").Image("Select record").Click
'Browser("UWindsor").Page("ENG").Frame("_sweview_7").Link("Line Items").Click
'Browser("UWindsor").Page("ENG").Frame("_swescrnbar").Link("Invoices").Click
--------------

I have written a looping code

Code:
Browser("UWindsor").Page("ENG").Frame("_swescrnbar").Link("Invoices").Click

Browser("UWindsor").Page("ENG").Frame("_sweview").Link("Line Items").Click
Browser("UWindsor").Page("ENG").Frame("_swescrnbar").Link("Invoices").Click

i=2
While i<=10
Browser("UWindsor").Page("ENG").Frame("_sweview_"&i).Image("Select record").Click
i = i + 2
Browser("UWindsor").Page("ENG").Frame("_sweview").Link("Line Items").Click
Browser("UWindsor").Page("ENG").Frame("_swescrnbar").Link("Invoices").Click
Wend
Browser("UWindsor").Page("ENG").Sync
-----
When I run this looping code, I get the error message that the "_sweview_8" frame object repository was not found in the object repository. Can anybody suggest what i should do or any alternate method to solve this problem? Thanks


RE: Using looping method to test selection of many records - VENKATAREDDY_M - 09-30-2008

Hi,

Can you try with loop <= 7

Pls use "While i<=7" instead of "While i<=10" in your loop

A sper your recored script, sweview_8 object is not there.

This should work. else pls let me know how many sweview objects are available in your OR

Thanks

VENKATA


RE: Using looping method to test selection of many records - mahadevan.swamy - 10-01-2008

never mind. I already solved this problem. It is the problem with the object repository. thanks for your input Smile