did you get solution, if not please try below code.
1.Question:
Browser("creationtime:2").close
2.Question
column_count=Browser("Google_2").Page("How to create a
table").WebTable("This is caption.").ColumnCount(1)
row_count=Browser("Google_2").Page("How to create a table").WebTable("This
is caption.").RowCount
'msgbox x
x=Browser("Google_2").Page("How to create a table").WebTable("This is
caption.").GetCellData(1,1)'(column_count,row_count)
msgbox x
Set fso=createobject("scripting.filesystemobject")
Set fs=fso.CreateTextFile("D:\QTP Lab\Sagar Practice\Test
Data\webtable.txt")
fs.WriteLine "No.of Rows in a Table:"&space(3)&row_count
fs.WriteLine "No.of Columns in a Table:"&space(3)&column_count
fs.Close
For i=0 to row_count
msgbox i
For j=2 to column_count
msgbox j
'If (Browser("Google_2").Page("How to create a table").WebTable("This is
caption.").GetCellData(j,i)=ncount Then
'
' ncount = ncount+1
' end if
Next
Next
Pl.let me know if it is not working.
Regards,
Sagar
On Fri, Oct 9, 2009 at 10:05 AM, savy <[email protected]> wrote:
>
> Forgot to add Looping process:
>
> row_count = tableobject.rowcount
> Note:
> 1. get total number of columns in the table. (column_count)
> 2. Note which cell to start from (usually first row will be used
> for naming each column, if so, you have to skip it in the looping.
> Following example assumes this scenario and initializes looping
> variable accordingly)
> 3. Get each cell data from excel sheet.
>
> Note: This loop first completes all the rows in a column and then
> moves to next column to repeat the same.
> for i = 1 to column_count
> for j=2 to row_count
> If(NOT (tableobject.getcelldata(j,i) = cell data from excel)) then
> ncount = ncount+1 'counter to know how many cell values
> did not match
> end if
> Next
> Next
>
> I have not addressed how to get cell data from excel sheet. This you
> have to figure it out.
>
> Hope this helps.
>
> Nimith
>
>
> On Oct 9, 6:53 am, savy <[email protected]> wrote:
> > Roman has already answered first part of your question.
> >
> > For the second part, get the table object and loop through it to get
> > each cell data (using getcelldata(row,column)).
> >
> > While you get each cell data you can compare that to corresponding
> > excel cell data.
> >
> > Nimith
> >
> > On Oct 9, 6:47 am, Roman Zilber <[email protected]> wrote:
> >
> > > Browser("creationti me:=3").Close
> >
> > > On Thu, Oct 8, 2009 at 5:10 PM, venkata bala subramanyam <
> >
> > > [email protected]> wrote:
> >
> > > > Hi friends,
> >
> > > > I faced questions in an interview?Please clarify the answers for me.
> >
> > > > 1) 4 browsers opened.I would like to cloes the latest browser which
> is
> > > > opened by us.?
> > > > I know upto based on creation time shall we close the browsers?
> > > > If Browser("creationti me:=0").exist then
> > > > Browser("creationti me:=0").close
> > > > End if .
> > > > i think this scipt for only one browser is opened.
> >
> > > > 2)How can we get the data from Web table?
> >
> > > > I think by using Getcelldata.I would like to get entire table data
> and
> > > > compare to the excel data.How can we get it..
> >
> > > > Little bit urgent ,
> >
> > > > Thanks & Regards,
> > > > --
> > > > Venkata Bala
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---