Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get values from dropdown the. Save it to excel
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
My webpage has couples of dropdown. I want to get all the values from each dropdown and save them to excel with QTP. Is it possible?
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,
Yes it is possible.Sample code is shown below.The below code will add all the items in "departing from" list to the excel sheet "List.xls"
Code:
list=Browser("Browser").Page("Find a Flight: Mercury").WebList("fromPort").GetROProperty("all items")
arrItems=split(list,";")
Set oExcelApp=CreateObject("Excel.Application")
oExcelApp.visible=True
oExcelApp.Workbooks.open  "D:\List.xls"
oExcelApp.Workbooks(1).Activate
Set oExcelSheet=oExcelApp.ActiveWorkbook.WorkSheets(1)
oExcelSheet.activate
For i=lbound(arrItems) to ubound(arrItems)
    oExcelSheet.Cells(i+1,1)=arrItems(i)
Next
oExcelApp.WorkBooks(1).Save

oExcelApp.quit
Set oExcelApp=nothing
Set oExcelSheet=nothing
*Note :For the code to run properly
  1. Open http://newtours.demoaut.com/mercuryreservation.php
  2. Login with user id: mercury and pwd :mercury
  3. Add the object "Departing from" list item to the object respository.
  4. Make sure that the List.xls is created in 'D' Drive
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Different Type of Dropdown Selector zunebuggy 6 3,429 05-01-2018, 06:46 PM
Last Post: zunebuggy
  Need help for copying values from one excel to another excel vinodhiniqa 0 1,363 07-06-2017, 05:33 PM
Last Post: vinodhiniqa
  How import final calculated values by cell formula from Excel not the formula itself. qtped 1 4,861 01-17-2017, 04:05 PM
Last Post: sagar.raythatha
Smile Importing Excel sheet - Reference Values are not recognized michiusa69 3 7,885 01-23-2015, 02:36 AM
Last Post: lkng2001
  Not able to click text inside the grid dropdown szkapoo 6 4,655 12-20-2014, 09:43 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)