How to export(copy) the entire webtable from the webpage
into Excelsheet? using Vb scripting
Answers were Sorted based on User's Feedback
Answer / vikas sachdeva
For this first u need to add a webtable in the object
repository and use this line
dim xl
set xl=createobject("Excel.Application")
xl.workbooks.open "c:/book1.xls"
set nsheet=xl.sheets.item(1)
row=Browser("browser").page("page").webtable
("table").getroproperty("rows")
cols=Browser("browser").page("page").webtable
("table").getroproperty("cols")
for i=0 to row-1
for j=0 to col-1
val=Browser("browser").page("page").webtable
("table").getcelldata(i,j)
nsheet.cells(i,j)=val
next
next
| Is This Answer Correct ? | 18 Yes | 3 No |
Answer / rentalavdml
Can u be clear in the question you mean copy the contents
of the webtable into excel or you need the whole webtable
object into excel
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / raj
Please try this code. It will save the whole WebTable
content in the form of excel sheet.
Environment("Peportpath")="C:\Result.xls"
a=Browser("Google").Page("Google").WebTable
("index:=0").GetROProperty("outerhtml")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WriteFile = FSO.CreateTextFile( Environment
("Peportpath"), True)
writeFile.writeLine(a)
writeFile.close
| Is This Answer Correct ? | 9 Yes | 1 No |
Answer / yogesh
Well,
I think you can copy all webtable (the table that is
displayed on your test application) values into runtime
table or datatable using two simple for loop and then
export the runtime table to excel file with the command as
mentioned by Shridhar.
I havent written any such script as of now. but will post
it here when I write it.
Thanks,
Yogi.
| Is This Answer Correct ? | 1 Yes | 1 No |
Sridhar thanks for the response. My question is I wanted to
use the runtime webtable clomuns and rows as input to the
another application during run time.
I have one application when we run with some inputs will
get the results as a webtable format in the web
application. I wanted to use those inputs as a input to
the another application during runtime.
Please let me know if your not clear with my question.
Thanks in advance.
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / jay prakash
As QTP Supports Data Corelation very well.. So the output
from one obj/table can be used as input to another
obj/table. As Yogi explained... you capture your values in
the runtime data table and use it as the input to ur
requirement. Simple Data Driven testing strategy will help
you.
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sridhar
Use DataTable.export('path of the x.ls') method and write
all the contents into excel file. Hope this helps else letm
e know.
Sridhar.
| Is This Answer Correct ? | 1 Yes | 5 No |
Is the provision for integrating QTP with QC ,available from the version 9.0 onwards only or even 8.2 version has such provisions?
If I am scripting Web-based Surveys using QTP that open up differently but at the exact same point require a username and password can I automate that username and password for all the surveys some how using QTP?
how u write vb script in qtp pls give me some basic script and some material
32 Answers Datamatics, UHG, Winit,
What are Child Objects?
In automation testing Can we retest virtual object in the application after getting new version from the developers, is there any property will change for that object or it won't.?
If there are 10 notepads opened on desktop. how can we close a particular 2nd notepad using script
Explain about the Test Fusion Report of QTP?
When can shared object repository fails?
This is a question thats generally asked in every QTP interview. What were the problems that you faced during automation and how did you resolve them?
What is QTP scenario.
what is diffrense between action and function
What are the factors on which script execution time is dependent?