Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WebTable Name keeps changing
#1
Solved: 11 Years, 4 Months ago
Hi All ....
Description: I have to write a script for clicking all the links in a webtable in a flow,the flow consist of 2 tables,I used For loop to click all the links one by one...the problem is when I click the first Link in first table ..it leads to the second table..and when i click on the second link in first table it leads to second table(but now the table name is different)
1st table(1st link)------>2nd table(1st link)
here i should click all the links in 2 table and goes
back to first table
1st table(2nd link)------>2nd table(1st link) now the webtable name of 2nd
is changed...so i am getting the error webtable
name not found in repository
I think you guys have understood what is my problem..Can any one help to find out a solution for it please..Please check with the below code......I have attached the same code as attachment too

Code:
RowCount = Browser("Browser").Page("Page").WebTable("Convertible").RowCount
ColumnCount = Browser("Browser").Page("Page").WebTable("Convertible").ColumnCount(1)

For a = 1 To RowCount
    
    For b = 1 To ColumnCount
        
        Set cfsmake= Browser("Browser").Page("Page").WebTable("Convertible").ChildItem(a,b,"Link",0)
            cfsmake.Click
        R1 = Browser("Browser").Page("Page").WebTable("Aston Martin").RowCount
        C1 = Browser("Browser").Page("Page").WebTable("Aston Martin").ColumnCount(1)
            
        For a1 = 1 To R1
            
            For b1 = 1 To C1
                
                cellData = Browser("Browser").Page("Page").WebTable("Aston Martin").GetCellData(a1,b1)
                If cellData = Browser("Browser").Page("Page").WebTable("Aston Martin").GetCellData(R1,C1-1) Then
                      Browser("Browser").Page("Page").Link("Home").Click
                Else     
                    Set cfsmake= Browser("Browser").Page("Page").WebTable("Aston Martin").ChildItem( a1 , b1 ,"Link",0)
                          cfsmake.Click
                        Browser("Browser").Back
                         b1 = b1+1
                 End If
             Next
        Next
    Next
Next

Please do the need full


Attached Files
.txt   script.txt (Size: 1.02 KB / Downloads: 91)
Reply
#2
Solved: 11 Years, 4 Months ago
make a generic function using descriptive programming...call the function in the loop...you will save so many For Next statements.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 4 Months ago
Hi Ankur:

Thanks for your reply,To be frank i am just a beginner in QTP,I dont have any idea of generic function ,Can you please give me an idea of generic functions ,How to use it and if possible give me some example scripts ....so that it will be very useful for me ...Thanks in Advance
Reply
#4
Solved: 11 Years, 4 Months ago
ok to get an idea of how function and DP works...here is an example of a function to count no of rows in a Siebel app... trust it will help you...
https://www.learnqtp.com/how-to-count-to...t-visible/
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Page element keep changing chong67 4 4,620 11-08-2016, 09:17 PM
Last Post: Paul Rammone
  Changing QTP Class praveendasika 1 2,930 07-13-2012, 07:35 AM
Last Post: ravi.gajul
  Objects keep changing names janriis 2 3,550 09-28-2010, 12:54 PM
Last Post: janriis
  Changing URL capf 2 7,371 09-14-2010, 07:31 PM
Last Post: bfakruddin
  Changing ONE item in a repository mrmarkus48 0 1,805 04-24-2009, 01:06 AM
Last Post: mrmarkus48

Forum Jump:


Users browsing this thread: 1 Guest(s)