You are on page 1of 6

descriptive programing, how to get the values from the datatable to the script,I E Set objIE = CreateObject("InternetExplorer.Application") If objIE.

visible = True Then objIE.Navigate("http://www.jetblue.com/") End If 'objIE.visible = True 'objIE.Navigate("http://www.jetblue.com/") Browser("name:=JetBlue.*").Page("title:=JetBlue.*").Image("alt:=TrueBlue Awards" ).FireEvent "onmouseover" Browser("name:=JetBlue.*").Page("title:=JetBlue.*").Image("alt:=TrueBlue Awards" ).Click Browser("name:=JetBlue.*").Page("title:=JetBlue.*").Image("alt:=TrueBlue Registr ation").Click set A=Browser("name:=JetBlue.*").Page("title:=JetBlue.*") 'Email=getTimeDate()&"abc@hotmail.com" Email=getTimeDate()&DataTable("E_id", dtGlobalSheet) A.WebEdit("html id:=reg_email").Set Email A.WebEdit("html id:=ver_email").Set Email A.WebEdit("html id:=reg_password").Set DataTable("PW",dtGlobalSheet) A.WebEdit("html id:=ver_password").Set DataTable("PW",dtGlobalSheet) A.WebList("name:=contact_title").Select DataTable("Title",dtGloblaSheet) A.WebEdit("name:=addr_name_f").Set DataTable("Fname",dtGlobalSheet) A.WebEdit("name:=addr_name_l").Set DataTable("Lname",dtGlobalSheet) A.WebEdit("name:=address1").Set DataTable("Addr1",dtGlobalSheet) A.WebEdit("name:=city").Set DataTable("City",dtGlobalSheet) A.WebList("name:=state").Select DataTable("State",dtGlobalSheet) A.WebEdit("name:=zip").Set DataTable("ZIP",dtGlobalSheet) A.WebEdit("name:=home_phone").Set DataTable("TelNo",dtGlobalSheet) A.Image("name:=contactSubmit","index:=0").Click Set B=Browser("name:=JetBlue.*").Page("title:=JetBlue.*") B.WebRadioGroup("name:=optButtonlist","html id:=optButtonlist_0").Select "Yes" B.WebList("name:=listHomeAirport").Select "Long Beach, CA (LGB)" B.WebList("html id:=listFavDest1").Select "Baltimore, MD (BWI)" B.WebCheckBox("html:=TandCCheckBox").Set "ON" B.Image("html id:=buttonContinue").FireEvent "onmouseover" B.Image("html id:=buttonContinue").Click Object repository: when ever u record an appl, all the properties of that pertic ular object are captured and stored in the OR. in OR u have the static properties, to get all the properties u can get them usi ng Ob spy. Virtual objects--when QTP cannot recog then we create virtual objects using desc ription.create() Data Base Connection '********************************************************************** ' Name: acsSetDDTFields

' Purpose:This sub goes to the NewContractData access database ' and sets variable s to equal the values of the requested row in the ' recordset. The p ublic variables it sets can then be used in ' scenarios. The var iables are: ' Creator: Mark Clemens ' ' FirstName, LastName, MI, SSN, SSType, ContrEffDate, ContractType ' BusFirm, FirmCode ' DOB, RecruitmentSource, PRNumber_LastName_SharePercent ' OneRNumber_LastName_SharePercent, TwoRNumber_LastName_SharePercent ' ThreeRNumber_LastName_SharePercent, FourRNumber_LastName_SharePercent ' FirstNominatorNum_LastName_SharePercent, SecondNominatorNum_LastName_SharePer cent ' FederalTaxStatus, MaritialStatus, NumFederalExemptions, Gender, EEOC ' CulturalMarket, PrimaryLanguage, AddlLanguage, YearsOfEducation ' CareerProfileScore, CLU, PrevInsCompany, CollegeGrad, CLUDate, MonthlySalary ' NextPrevOccupation, NumMonthsPrevOccupation, MonthsLifeInsExperience ' TrainingPrepCode, PreviousOccupation, RACountry, RAAddLines ' RACity, RAState, RAZip, LACountry, LAAddLines ' LACity, LAState, LAZip, PSICode, MailCode, AgntInGenSalesOffice ' SpouseFName, SpouseLName, SpouseMI, SpouseDOB, SpouseGender, SpouseSSN ' SpouseSSNType, SpouseCountry, SpAddLines ' SpCity, SpState, SpZip ' ' If there is a need for further clarification concerning the relationship ' between these varia bles and the data fields on the Agent Contract ' web site please con tact the TCC regression automation staff. ' ' Param: iRow required ' AllowedRange: ' Description: The row number in the recordset to use to set the variables ' ' Param: sTag optional AssumedValue="" ' AllowedRange: ' Description: This value is a free entry field that can be used to filter rows to be used for ' data driving. If it is not passed in, all rows are returned. ' ' Returns: N/A '**********************************************************************' Public Sub acsSetDDTFields(iRow, sTag) On Error Resume Next Dim cn, rs Dim iRsCounter, iCount ' Create the connection and recordset objects Set cn = CreateObject("adodb.Connection") EHRCHandler Err, "acsSetData", g_iSeverity Set rs = CreateObject("adodb.recordset") EHRCHandler Err, "acsSetData", g_iSeverity ' open the connection object

cn = odbcOpenConnection ("",g_sTestwarePath & "\Apps\ACS\Data\NewCon tractData.mdb", "admin", "", "Jet") EHRCHandler Err, "acsSetData", g_iSeverity ' if the tag filter was passed in, use it in the SQL, otherwise retu rn all records If sTag = "" Then iCount = odbcOpenRecordset(cn, "Select * From ContractDa ta", adOpenKeySet, rs) EHRCHandler Err, "acsSetData", g_iSeverity Else iCount = odbcOpenRecordset(cn, "Select * From ContractDa ta Where Tag = '" & sTag & "'", adOpenKeySet, rs) EHRCHandler Err, "acsSetData", g_iSeverity End If ' If the row passed in is greater than the row count, throw an error . If iRow > iCount Then Err.Number = g_iOUT_OF_RANGE Err.Description = "Request for data for driving was for row greater than the actual row count. " & _ "Requested row = " & iRow & ", b ut total row count is " & iCount & "." EHRCHandler Err, "acsSetData", g_iSeverity Exit Sub End If 'Set the counter iRsCounter = 0 ' Loop until the end of the recordset Do Until rs.EOF ' If the row in the recordset equals the requested row t hen ' set the variables to equal the field values for that r ecordset If iRsCounter = iRow - 1 Then FirstName = rs.Fields("FirstName").Value LastName = rs.Fields("LastName").Value MI = rs.Fields("MI").Value SSN = rs.Fields("SSN").Value SSType = rs.Fields("SSType").Value ContrEffDate = rs.Fields("ContrEffDate").Val ue ContractType = rs.Fields("ContractType").Val ue BusFirm = rs.Fields("BusFirm").Value FirmCode = rs.Fields("FirmCode").Value DOB = rs.Fields("DOB").Value RecruitmentSource = rs.Fields("RecruitmentSo urce").Value PRNumber_LastName_SharePercent = rs.Fields(" PRNumber_LastName_SharePercent").Value OneRNumber_LastName_SharePercent = rs.Fields ("OneRNumber_LastName_SharePercent").Value TwoRNumber_LastName_SharePercent = rs.Fields ("TwoRNumber_LastName_SharePercent").Value ThreeRNumber_LastName_SharePercent = rs.Fiel

ds("ThreeRNumber_LastName_SharePercent").Value FourRNumber_LastName_SharePercent = rs.Field s("FourRNumber_LastName_SharePercent").Value FirstNominatorNum_LastName_SharePercent = rs .Fields("FirstNominatorNum_LastName_SharePercent").Value SecondNominatorNum_LastName_SharePercent = r s.Fields("SecondNominatorNum_LastName_SharePercent").Value FederalTaxStatus = rs.Fields("FederalTaxStat us").Value MaritialStatus = rs.Fields("MaritialStatus") .Value NumFederalExemptions = rs.Fields("NumFederal Exemptions").Value Gender = rs.Fields("Gender").Value EEOC = rs.Fields("EEOC").Value CulturalMarket = rs.Fields("CulturalMarket") .Value PrimaryLanguage = rs.Fields("PrimaryLanguage ").Value AddlLanguage = rs.Fields("AddlLanguage").Val ue YearsOfEducation = rs.Fields("YearsOfEducati on").Value CareerProfileScore = rs.Fields("CareerProfil eScore").Value CLU = rs.Fields("CLU").Value PrevInsCompany = rs.Fields("PrevInsCompany") .Value CollegeGrad = rs.Fields("CollegeGrad").Value CLUDate = rs.Fields("CLUDate").Value MonthlySalary = rs.Fields("MonthlySalary").V alue NextPrevOccupation = rs.Fields("NextPrevOccu pation").Value NumMonthsPrevOccupation = rs.Fields("NumMont hsPrevOccupation").Value MonthsLifeInsExperience = rs.Fields("MonthsL ifeInsExperience").Value TrainingPrepCode = rs.Fields("TrainingPrepCo de").Value PreviousOccupation = rs.Fields("PreviousOccu pation").Value RACountry = rs.Fields("RACountry").Value RAAddLines = rs.Fields("RAAddLines").Value RACity = rs.Fields("RACity").Value RAState = rs.Fields("RAState").Value RAZip = rs.Fields("RAZip").Value LACountry = rs.Fields("LACountry").Value LAAddLines = rs.Fields("LAAddLines").Value LACity = rs.Fields("LACity").Value LAState = rs.Fields("LAState").Value LAZip = rs.Fields("LAZip").Value PSICode = rs.Fields("PSICode").Value MailCode = rs.Fields("MailCode").Value AgntInGenSalesOffice = rs.Fields("AgntInGenS alesOffice").Value MarriageDate = rs.Fields("MarriageDate").Val ue SpouseFName = rs.Fields("SpouseFName").Value SpouseLName = rs.Fields("SpouseLName").Value

SpouseMI = rs.Fields("SpouseMI").Value SpouseDOB = rs.Fields("SpouseDOB").Value SpouseGender = rs.Fields("SpouseGender").Val ue SpouseSSN = rs.Fields("SpouseSSN").Value SpouseSSNType = rs.Fields("SpouseSSNType").V alue SpouseCountry = rs.Fields("SpouseCountry").V alue SpAddLines = rs.Fields("SpAddLines").Value SpCity = rs.Fields("SpCity").Value SpState = rs.Fields("SpState").Value SpZip = rs.Fields("SpZip").Value Tag = rs.Fields("Tag").Value ' Exit the Do Loop EHRCHandler Err, "acsSetData", g_iSeverity Exit Do End If ' increment the counter iRsCounter = iRsCounter + 1 ' move to the next row in the recordset rs.MoveNext Loop End Sub '********************************************************************** ' Name: acsGetDDTRecordCount ' Purpose:This function returns the recordcount of the NewContractDat a database ' that is used for data driving the Agent Contract scenarios. ' Creator: ' ' Param: sTag optional AssumedValue="" ' AllowedRange: ' Description: This value is a free entry field that can be used to filter rows to be used for ' data driving. If it is not passed in, all rows are returned. ' ' Returns: N/A '**********************************************************************' Public Function acsGetDDTRecordCount(sTag) On Error Resume Next Dim cn, rs ' Create the connection and recordset objects Set cn = CreateObject("adodb.Connection") Set rs = CreateObject("adodb.recordset") ' open the connection object cn = odbcOpenConnection ("",g_sTestwarePath & "\Apps\ACS\Data\NewCon tractData.mdb", "admin", "", "Jet") EHRCHandler Err, "acsSetData", g_iSeverity ' if the tag filter was passed in, use it in the SQL, otherwise retu rn all records

If sTag = "" Then acsGetDDTRecordCount = odbcOpenRecordset(cn, "Select * F rom ContractData", adOpenKeySet, rs) EHRCHandler Err, "acsSetData", g_iSeverity Else acsGetDDTRecordCount = odbcOpenRecordset(cn, "Select * F rom ContractData Where Tag = '" & sTag & "'", adOpenKeySet, rs) EHRCHandler Err, "acsSetData", g_iSeverity End If End Function Call a Function Public Function addTwo(sFirstNum,sSecondNum) Dim sumTwo sumTwo = sFirstNum +sSecondNum addTwo = sumTwo End Function SumOfTwoNumber = addTwo(20,30) msgbox SumOfTwoNumber Reporter.report event Public sub LoginTrueBlue() Systemutil.Run"C:\Program Files\Internet Explorer\IEXPLORE.EXE","https://www. jetblue.com/trueblue/" If Browser("name:=JetBlue.*").Page("title:=JetBlue.*").Exist then Reporter.ReportEvent micPass, "TrueBlue page Displays", "Able to open TueBlue page" Else Reporter.ReportEvent micFail, "TrueBlue page not Displays", " Not Able to op en TueBlue page" End if End Sub

You might also like