Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to copy webpage into excel using qtp
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
I get this error on running the script:
general run error:
Code:
Set WebEdits=Browser("Title:=Financial Analysis").Page("Title:=Financial Analysis").ChildObjects(desc)

also, what i am trying to achieve is launch url-->copy paste data from that page--> into excel--> quit browser-->launch browser again and enter new url.
for every url http://emops.tse.com.tw/server-java/t05s...&year=2004, co_id(2463 in this case) is a variable which will be different everytime i launch a browser.


also, my settings in qtp are run test on any browser window and on any windows application.

Code:
For i=0 to 1991


SystemUtil.Run "C:\Program Files\Mozilla Firefox\firefox.exe","","c:\documents and settings\Harp ","open"




Dim url1, url2, url3, url

url1= datatable.Value("A", dtlocalsheet)
url2=datatable.Value("B",dtLocalsheet)
url3= datatable.value("C",dtlocalsheet)

url= url1&url2&url3

Window("Mozilla Firefox").WinObject("MozillaWindowClass").Type url
Window("Mozilla Firefox").WinObject("MozillaWindowClass").Type  micReturn
wait(4)

Set desc=Description.Create()
desc("micclass").value="WebTable"
desc("text").Value="200220032004Capital structure analysis.*"
Set WebEdits=Browser("Title:=Financial Analysis").Page("Title:=Financial Analysis").ChildObjects(desc)
cCount=WebEdits(0).getROProperty("cols")
rCount=WebEdits(0).getROProperty("rows")

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook= objExcel.Workbooks.Open("C:\Documents and Settings\Harp\Desktop\ForumExcel.xls")
Set objSheet=objExcel.Sheets("Sheet1")

For m=1 To rCount
For n=1 To cCount
data=WebEdits(0).GetCellData(m,n)
If (Instr(data,"analysis (%)") <> 0 OR Instr(data,"flow (%)") <> 0)Then
objsheet.Cells(m,n).Value=data
n=cCount
else
objsheet.Cells(m,n).Value=data
End If
Next
Next
objWorkbook.save
objWorkbook.close
objExcel.Quit
set objExcel=nothing

window("mozilla firefox").Close
wait(5)
next





is this correct? try running this code on your machine.

for getting the url, put this in 3 or 4 rows in column A of action1 sheet:
http://emops.tse.com.tw/server-java/t05s...show&co_id=
Coumn B:
3006
2498
2463
Column C:
&year=2004
&year=2004
&year=2004


in test settings from File, i have "run on all rows" in the Run tab. i am trying to provide all info for you to narrow down the cause of error. Hope this helps. thank you for chasing this.
Reply


Messages In This Thread
RE: how to copy webpage into excel using qtp - by harp - 10-07-2010, 07:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  webpage WinObject has same name Ananthakumar_S 0 1,693 11-30-2016, 09:48 PM
Last Post: Ananthakumar_S
  Check specific links of a webpage rocky9 1 2,702 06-11-2015, 06:23 PM
Last Post: venkatesh9032
Exclamation How to verify whether pdf is completely loaded or not in webpage nmakkena 1 2,672 08-27-2014, 04:09 PM
Last Post: vinod123
  Handling .NET framework menu in webpage using QTP 10 vishnu1067 0 2,332 05-15-2014, 05:30 PM
Last Post: vishnu1067
  Comparing webtable data with weblist and webelements in other webpage arnav 1 5,811 04-18-2014, 10:01 PM
Last Post: Parke

Forum Jump:


Users browsing this thread: 2 Guest(s)