program Search_Expedia_Travelocity; // Fill out Newbie Form and simultaneously search // Expedia and Travelocity websites // Make sure Navigate() contains the correct directory // select "Launch in IE" when running this script var sUserOption, sFrom, sTo, sDepartDate, sReturnDate, sAdult : string; bExpedia : boolean; procedure OnDocumentComplete(URL : string); begin if IsPartOf('http://www.expedia.com/', URL) then begin if (sUserOption = 'flightonly') then ClickButtonValue('flt') else if (sUserOption = 'flighthotel') then ClickButtonValue('flthot'); // extract parameters from URL sUserOption := ExtractURLParam('UserOption'); sFrom := ExtractURLParam('From'); sTo := ExtractURLParam('To'); sDepartDate := ExtractURLParam('DepartDate'); sReturnDate := ExtractURLParam('ReturnDate'); sAdult := ExtractURLParam('Adult'); // Clear hidden fields Fill('FCity', ''); Fill('FTLA', ''); Fill('TCity', ''); Fill('TTLA', ''); Fill('fcy', sFrom); Fill('tcy', sTo); Fill('fdt', sDepartDate); Fill('tdt', sReturnDate); SelectListItem('rad1', sAdult); ExecuteWebScript('SF()', 'javascript'); bExpedia := True; end; if (bExpedia) then begin // search does't trigger OnDoc complete bExpedia := False; OpenInternetExplorer('http://www.travelocity.com'); end; if IsPartOf('http://www.travelocity.com', URL) then begin Fill('leavingFrom', sFrom); Fill('goingTo', sTo); Fill('leavingDate', sDepartDate); Fill('returningDate', sReturnDate); SelectListIndex('adults', StrToInt(sAdult)); if (sUserOption = 'flightonly') then ClickButton('submitFO') else if (sUserOption = 'flighthotel') then ClickButton('FHbutton'); end; end; begin bExpedia := False; Navigate('C:\Program Files\Newbie\Forms\airfare.htm'); end.