Option explicit
Dim u,b,fso,fo,x,y,uf,df,nop,tax,total
Set fso=createobject("scripting.filesystemobject")
Set fo=fso.OpenTextFile("c:\details.txt",1,false)

b="c:\Program Files\Internet Explorer\iexplore.exe"
u="http:\\www.newtours.demoaut.com/"
While fo.AtEndOfStream<>true
	invokeapplication b&" "&u
	x=fo.ReadLine
	y=split(x,",")
With browser("title:=Welcome: Mercury Tours")
With .page("title:=Welcome: Mercury Tours")
.webedit("name:=userName").set "admin"
.webedit("name:=password").set "admin"
.image("name:=login").click
End With
End With
With browser("title:=Find a Flight: Mercury Tours:")
With .page("title:=Find a Flight: Mercury Tours:")
.webRadiogroup("name:=tripType"). Select y(0)
.weblist("name:=passCount").Select  y(1)
.weblist("name:=fromPort").Select y(2)
.weblist("name:=fromMonth").Select y(3)
.weblist("name:=fromDay").Select y(4)
.weblist("name:=toPort").Select y(5)
.weblist("name:=toMonth").Select y(6)
.weblist("name:=toDay").Select y(7)
.webRadioGroup("name:=servClass").Select y(8)
.weblist("name:=airline").Select y(9)
.Image("name:=findFlights").Click


End With
End With
 with Browser("title:=Select.*")
 with .page("title:=Select.*")
 .webradiogroup("name:=outFlight").select "#1"
 .webradiogroup("name:=inFlight").select "#3"
 .image("name:=reserveFlights").click
 end with
 end with
 With browser("title:=Book.*")
 With .page("Title:=Book.*")
 uf=.webtable("height:=190","width:=484").GetCellData(3,3)
 df=.webtable("height:=190","width:=484").GetCellData(6,3)
 nop=.webtable("height:=190","width:=484").GetCellData(7,2)
 tax=.webtable("height:=190","width:=484").GetCellData(8,2)
 total=.webtable("height:=190","width:=484").GetCellData(9,2)
 tax=mid(tax,2,len(tax)-1)
 total=mid(tax,2,len(total)-1)
 tax=ccur(tax)
 total=ccur(total)
 
 If total=[cint(uf)+cint(df)] *cint(nop)+tax Then
Reporter.ReportEvent micPass,"calculation testing","correct calculation"

	 else 
Reporter.ReportEvent micfail,"calculation testing","wrong total"

 End If
 .link("name:=SIGN-OFF").Click

 End With
 End With
browser("title:=.*").Close
wend
fo.Close
Set fo=nothing
Set fso=nothing