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 |
WHAT IS DIFFERENCE B/W QC 9.2 AND QC 10.0
What is the extension of the recovery scenario file in qtp?
how we will use output values in qtp? is there any possibulity by descriptive programming?
Explain how you can find length of array in qtp?
How to Compare the 2 xl-sheets in QTP? ple write the vb Script for the comparison?
Hello, I am learning QTP. I have recorded test for Login page, i have also inserted checkpoint for Email field & when I run test it passed. But when i tried to run test by inserting 'Adding Parameter Values to a Data Table' for email & password field, it pass the first value in both the fields but after that when test run for second parameter values it displays 'Internet Explorer cannot open the Internet site, Operation aborted' & when i analyze test result it displays run time error 'Object disable'. I have also cleared all the history from IE but it is not working. Please help me. Thank you.
i'm using the qtp to test to vb appliction,i wanted to get the new application's title.i didn't want to use the winAPI to get it ,i 'd like to know whether a QTP function can do it. Eg: SystemUtil.Run "C:\Program Files\.....","","","" 'run an application, and misure the application is activating,then how to get the hwn wihtout using windowns api
Hi im new in Testing..can any one plz re-write this code SystemUtil.Run "C:\Program Files\Mozilla Firefox\firefox.exe","","C:\Program Files\Mozilla Firefox","open" ----using for loop(for i=0;i<=10;i++ )
Scripts for Ascending order in qtp.
what is batch testing?
GET WHETHER THE GIVE NUMBER VALID OR NOT IN BETWEEN THE GIVEN RANGE?IN VB SCRIPT(QTP)
IF I SET THE VIRTUAL OBJECT AFTER THAT MAXIMIZE THE APPLICATION THEN QTP SENT ERROR OR EXECUTE SUCCESSFULLY? WHY ?