Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data table overwrite the value
#1
Not Solved
Hi there i am trying to capture all the value when i run this script
But when run it the value it captures and insert into the data table. But it captures the values of second vehicle it overwriites the values of 1st vehicle.

Code:
Dim bro, url, image

bro = "iexplore"
url = "http://www.chevrolet.com/tools/help-choose-vehicles.html"

systemutil.Run bro, url
browser("title:=.*").Sync
wait 15

DataTable.GetRowCount    
i=0

Set mypage=browser("title:=.*").page("title:=.*")


While mypage.image("class:=mm size_3","index:="&i).exist
mypage.Sync
wait 3
                                                Datatable( "VehicleName", dtGlobalSheet )= mypage.image("class:=mm size_3","index:="&i).getroproperty("filename")
                                              Datatable( "VehicleName", dtGlobalSheet )= mypage.image("class:=mm size_3","index:="&i).getroproperty("href")
                                                Datatable( "HelpMeChooseMSRP", dtGlobalSheet )= mypage.WebElement("class:=tx_price","index:="&i).getroproperty("innertext")

   mypage.image("class:=mm size_3","index:="&i).click
                mypage.Sync
                wait 4

i=i+1

                Set desc2=description.Create
                  desc2("micclass").value="WebElement"
                  desc2("class").value="parbase ts_attr_c1 section"
                  Set obj2=browser("title:=.*").page("title:=.*").ChildObjects(desc2)
                Datatable( "MSRPonMOPAGE", dtGlobalSheet )=obj2(0).getroproperty("innertext")
                Datatable.SetCurrentRow(i)


Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False
Datatable.Export("C:\Users\Wajahat.awan\Desktop\Automation\Private DHC\Chevy DHC\Default.xls")
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\Wajahat.awan\Desktop\Automation\Private DHC\Chevy DHC\Default.xls")
objWorkbook.SaveAs ("C:\Users\Wajahat.awan\Desktop\Automation\Private DHC\Chevy DHC\MRSP Verify code" & Day(Date) & Month(Date) & Year(Date) & ".xls")
objExcel.Quit

wait 6
     browser("title:=.*").Back
  Wend
Reply
#2
Not Solved
As mentioned at the top, please ensure to include your code between tags while asking or replying to questions for better readability.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Not Solved
Change initial value

i = 1 instead of i = 0
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with Select checkbox from data table value jayraocourts 0 1,298 11-01-2019, 10:25 PM
Last Post: jayraocourts
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,836 11-13-2013, 10:24 PM
Last Post: sai rajesh
  DP is not returning the whole table data content soumen 6 5,239 10-02-2013, 12:05 PM
Last Post: vvcyril
  Script running more times than the values in global data table TPavani 5 4,399 10-04-2012, 11:18 PM
Last Post: krr
  Unable to enter data in web table nistalaramesh 8 10,784 07-13-2012, 09:14 PM
Last Post: nistalaramesh

Forum Jump:


Users browsing this thread: 1 Guest(s)