08-25-2010, 05:50 PM
Hi Anu,
Please follow the below approach
1. File-->Settings-->Run-->Run One Iteration only
2. Copy the entire code as I mentioned below
3. Add the objects to object repository as like in the attached screen shot (Here “Phone table” object and “Next link” are in object repository)
4. Execute the script
5. Observe that it will work as expected
I hope now u will get some idea.
Regards,
Venkat.Batchu
Please follow the below approach
1. File-->Settings-->Run-->Run One Iteration only
2. Copy the entire code as I mentioned below
3. Add the objects to object repository as like in the attached screen shot (Here “Phone table” object and “Next link” are in object repository)
4. Execute the script
5. Observe that it will work as expected
Code:
'intpages=Total no of pages here it is 293
Datatable.GlobalSheet.AddParameter "PhoneNo",""
Datatable.GlobalSheet.AddParameter "Name",""
Datatable.GlobalSheet.AddParameter "Address",""
For p=1 to 293 step 1
rcount=Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").WebTable("innertext:=Phone no.*").GetROProperty("rows")
For temp=2 to rcount-1 Step 1
intpno=Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").WebTable("innertext:=Phone no.*").GetcellData(temp,1)
strname=Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").WebTable("innertext:=Phone no.*").GetcellData(temp,2)
straddress=Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").WebTable("innertext:=Phone no.*").GetcellData(temp,3)
Datatable.SetCurrentRow(Datatable.GetRowCount+1)
Datatable.Value("PhoneNo","Global")=intpno
Datatable.Value("Name","Global")=strname
Datatable.Value("Address","Global")=straddress
If temp=rcount-1 Then
Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").Link("Next").Click
Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Sync
Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").Sync
Wait 3
End If
rcount=Browser("BSNL GUJARAT TELECOM CIRCLE:Ma").Page("BSNL GUJARAT TELECOM CIRCLE:Ma").WebTable("innertext:=Phone no.*").GetROProperty("rows")
Next
Next
Wait 2
Datatable.Export "C:\Output.xls"
I hope now u will get some idea.
Regards,
Venkat.Batchu