06-25-2013, 04:47 AM
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.
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