how to copy webpage into excel using qtp - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: how to copy webpage into excel using qtp (/Thread-how-to-copy-webpage-into-excel-using-qtp) Pages:
1
2
|
how to copy webpage into excel using qtp - harp - 10-07-2010 i am fairly a new user of qtp. i am trying to record a script which should copy the table in a webpage and its data. the copied data should be pasted into an excel sheet as unicode text (using paste special function of excel). i am facing problem in doing this as on running the script i am getting object not visible error. can someone please help me in figuring this out? the same process is used for 1992 times. and the webpage is opened through url's stored in local datasheet. Code: For i=0 to 1991 RE: how to copy webpage into excel using qtp - KavitaPriyaCR - 10-07-2010 Hi Is the data in the table of web page static? can u pls tell me how you are copying the table data? You can try with: Use the descriptive programming, to capture the table contents, and use paste special to paste the data into excel file. RE: how to copy webpage into excel using qtp - harp - 10-07-2010 the data in the table is static. you can a look at this page: http://emops.tse.com.tw/server-java/t05st22_e?TYPEK=sii&step=show&co_id=2463&year=2004 unfortunately idk how to use descriptive programming. copying that data: highlight the contents starting from debt ratio upto return on stock equity. after that i right click to copy data and then open a worksheet and then do the paste special. RE: how to copy webpage into excel using qtp - KavitaPriyaCR - 10-07-2010 Hi Try this, below script is the edited one, will give you the perfect output xls file Code: Set desc=Description.Create() RE: how to copy webpage into excel using qtp - harp - 10-07-2010 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/t05st22_e?TYPEK=sii&step=show&co_id=2463&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 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/t05st22_e?TYPEK=sii&step=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. RE: how to copy webpage into excel using qtp - KavitaPriyaCR - 10-08-2010 I have got installed QTP for only IE, here is the complete script, with no change you will get the result (Just paste this script, don't record). Code: CO_ID=Array(2463,3006,2498) And pls et me know if it worked. RE: how to copy webpage into excel using qtp - A.Saini - 10-08-2010 Hi Harp, In this case we are not able to use our normal (simple) approach to get the data of web table into Excel Sheet. There are 2 reasons of that: 1. If you add any data of the web table into repository, it's taking "innertext" & "html tag" as the mandatory property. The hierarchy is Browser->Page->WebElement (Data Table is note taken) and RE for Web Element also not working. 2. By using any combination of web table properties, QTP is not recognizing the table while using Descriptive Programming. But there is an alternative solution: The below code will give you the content of the table. You have to put that content at correct location in Excel Sheet. You can use properties like "class" etc. Code: Set objDesc = Description.Create I hope it will work for you.... RE: how to copy webpage into excel using qtp - harp - 10-08-2010 I am attaching the ForumExcel.xls file with output after the script executed completely. Apparently, the script saved data only for the first co_id. for subsequent array elements no data was input into the excel. Its working. i failed to notice sheets&k+1 can we get all data in sheet 1 itself - append data after the last row with data in sheet 1 and keep on doing that for every co-id? RE: how to copy webpage into excel using qtp - A.Saini - 10-08-2010 Hi, As per my understanding this Regular Expression will work only for first row not for the entire web table. Code: desc("text").Value="200220032004Capital structure analysis.*" Note: "text" value is totally different for each row. Well, it's very challenging problem .I will awesome if some senior QTP person share his/her views about it. RE: how to copy webpage into excel using qtp - harp - 10-08-2010 Hello M/s Priya and Mr. Saini, I am glad to inform that the script has run successfully. I made a few modifications to the script to add a new sheet each time the script runs.This will save me from the error when k+1 sheet is not present in the workbook. Adding a new worksheet makes my work easy as I can run a macro later to perform same action on all the data. Code: Set objExcel = CreateObject("Excel.Application") then rename the sheet to the co_id so that i know which sheet has which company's data and can be easily put into a SPSS file without any error. This was a huge data collection task and I am thankful to you guys for helping me achieve my goal. Thanks again. Solved. This thread stands solved. |