Hybrid Driven Framework VBScript in QTP/UFT

Here i written VBScript for hybrid driven framework using QTP/UFT tool, the spreadsheet column name like,

S.No. Test case ID Test case Description Expected Result Actual Result Method Element(Object) Activity Data Message Status SampleData HtmlID Name Title Text InnerText OuterText InnerHtml OuterHtml HtmlTag Value Abs_x Abs_y Disabled ReadOnly Href Url FileName Class ChildItem Rows Columns Index Style
Browser iexplore http://cr1.qdxsoft.com/user/login
WebEdit Set QM54439 membership

VERSION: 2 (version: 3 will be released later…)

Dim objExcel, objWorkbook, objWorksheet, RowsCount
‘Set obj=Browser(“name:=.*”).Page(“name:=.*”)
‘Set obj=Browser(“title:=Welcome to QADEX – Internet Explorer”).Page(“title:=Welcome to QADEX”)
‘Set obj=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”)
On error resume next
Set dobj=Dialog(“text:=Message from webpage”)
Set objExcel=Createobject(“Excel.Application”)
Set objWorkbook=objExcel.workbooks.Open(“C:\Users\selvaganapathy\Desktop\hybrid.xlsx”)
Set objWorksheet=objWorkbook.WorkSheets(1)
RowsCount=objWorksheet.UsedRange.Count
‘msgbox RowsCount
‘val=”iexplore.exe”
‘val2=”http://cr1.qdxsoft.com/user/login”
‘SystemUtil.Run val,val2
‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Sync
‘wait 60s
‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Sync
‘FireEvents Operations – onchange,onclick,ondblclick,onblur,onfocus,onmousedown,onmouseup,onmouseover,onmouseoutQM54439,onsubmit,onreset,onpropertychange
Dim i
For i=9 To 34 Step 1
‘wait 2
otype=objWorkSheet.Cells(i,7)
act=objWorkSheet.Cells(i,8)
data=objWorkSheet.Cells(i,9)
message=objWorkSheet.Cells(i,10)
sdata=objWorkSheet.Cells(i,12)
hid=objWorkSheet.Cells(i,14)
oname=objWorkSheet.Cells(i,15)
title=objWorkSheet.Cells(i,16)
text=objWorkSheet.Cells(i,17)
itext=objWorkSheet.Cells(i,18)
otext=objWorkSheet.Cells(i,19)
ihtml=objWorkSheet.Cells(i,20)
ohtml=objWorkSheet.Cells(i,21)
htag=objWorkSheet.Cells(i,22)
ovalue=objWorkSheet.Cells(i,23)
citem=objWorkSheet.Cells(i,32)
rows=objWorkSheet.Cells(i,33)
cols=objWorkSheet.Cells(i,34)
index=objWorkSheet.Cells(i,35)
sclass=objWorkSheet.Cells(i,36)
‘SGPPHybridCall
Call SGPPHybridCall(otype,act,data,message,sdata,hid,oname,title,text,itext,otext,ihtml,ohtml,htag,ovalue,citem,rows,cols,index,sclass)
Next

‘SGPPHybridCall Description

Function SGPPHybridCall(otype,act,data,message,sdata,hid,oname,title,text,itext,otext,ihtml,ohtml,htag,ovalue,citem,rows,cols,index,sclass)
Select Case otype

Case “Browser”
Set oBrowser=Description.Create()
‘ oBrowser(“micClass”).value=”Browser”
‘BrowserCall
Call browsercall(act,data)

Case “WebEdit”
Set oWebEdit=Description.Create()
oWebEdit(“micClass”).value=”WebEdit”
oWebEdit(“html id”).value=hid
oWebEdit(“name”).value=oname
oWebEdit(“text”).value=text
oWebEdit(“innertext”).value=itext
oWebEdit(“outertext”).value=otext
oWebEdit(“outertext”).value=otext
oWebEdit(“html tag”).value=htag
oWebEdit(“index”).value=index
oWebEdit(“class”).value=sclass

‘WebEditCall
Call SGPPWebEdit(oWebEdit,act,data)

Case “WebButton”
Set oWebButton=Description.Create()
oWebButton(“micClass”).value=”WebButton”
oWebButton(“html id”).value=hid
oWebButton(“name”).value=oname
oWebButton(“text”).value=text
oWebButton(“innertext”).value=itext
oWebButton(“outertext”).value=otext
oWebButton(“outertext”).value=otext
oWebButton(“html tag”).value=htag
oWebButton(“index”).value=index
oWebButton(“class”).value=sclass
‘WebButtonCall
Call SGPPWebButtont(oWebButton,act,data)

Case “Link”
Set oLink=Description.Create()
oLink(“micClass”).value=”Link”
oLink(“html id”).value=hid
oLink(“name”).value=oname
oLink(“text”).value=text
oLink(“innertext”).value=itext
oLink(“outertext”).value=otext
oLink(“outertext”).value=otext
oLink(“html tag”).value=htag
oLink(“index”).value=index
oLink(“class”).value=sclass
‘LinkCall
Call SGPPLink(oLink,act,data)

Case “WebList”
Set oWebList=Description.Create()
oWebList(“micClass”).value=”WebList”
oWebList(“html id”).value=hid
oWebList(“name”).value=oname
oWebList(“text”).value=text
oWebList(“innertext”).value=itext
oWebList(“outertext”).value=otext
oWebList(“outertext”).value=otext
oWebList(“html tag”).value=htag
oWebList(“index”).value=index
oWebList(“class”).value=sclass
‘WebListCall
Call SGPPWebList(oWebList,act,data)

Case “WebElement”
Set oWebElement=Description.Create()
oWebElement(“micClass”).value=”WebElement”
oWebElement(“html id”).value=hid
oWebElement(“name”).value=oname
oWebElement(“text”).value=text
oWebElement(“innertext”).value=itext
oWebElement(“outertext”).value=otext
oWebElement(“outertext”).value=otext
oWebElement(“html tag”).value=htag
oWebElement(“index”).value=index
oWebElement(“class”).value=sclass
‘WebElementCall
Call SGPPWebElement(oWebElement,act,data)

Case “WebCheckBox”
Set oWebCheckBox=Description.Create()
oWebCheckBox(“micClass”).value=”WebCheckBox”
oWebCheckBox(“html id”).value=hid
oWebCheckBox(“name”).value=oname
oWebCheckBox(“text”).value=text
oWebCheckBox(“innertext”).value=itext
oWebCheckBox(“outertext”).value=otext
oWebCheckBox(“outertext”).value=otext
oWebCheckBox(“html tag”).value=htag
oWebCheckBox(“index”).value=index
oWebCheckBox(“class”).value=sclass
‘WebCheckBoxCall
Call SGPPWebCheckBox(oWebCheckBox,act,data)

Case “WebRadioGroup”
Set oWebRadioGroup=Description.Create()
oWebRadioGroup(“micClass”).value=”WebRadioGroup”
oWebRadioGroup(“html id”).value=hid
oWebRadioGroup(“name”).value=oname
oWebRadioGroup(“text”).value=text
oWebRadioGroup(“innertext”).value=itext
oWebRadioGroup(“outertext”).value=otext
oWebRadioGroup(“outertext”).value=otext
oWebRadioGroup(“html tag”).value=htag
oWebRadioGroup(“index”).value=index
oWebRadioGroup(“class”).value=sclass
‘WebRadioGroupCall
Call SGPPWebRadioGroup(oWebRadioGroup,act,data)

Case “WebTable”
Set oWebTable=Description.Create()
oWebTable(“micClass”).value=”WebTable”
oWebTable(“html id”).value=hid
oWebTable(“name”).value=oname
oWebTable(“text”).value=text
oWebTable(“innertext”).value=itext
oWebTable(“outertext”).value=otext
oWebTable(“outertext”).value=otext
oWebTable(“html tag”).value=htag
oWebTable(“index”).value=index
oWebTable(“class”).value=sclass
‘WebRadioGroupCall
Call SGPPWebTable(oWebTable,act,data,citem,rows,cols,index)

Case “Frame”
Set oFrame=Description.Create()
oFrame(“micClass”).value=”Frame”
oFrame(“html id”).value=hid
oFrame(“name”).value=oname
oFrame(“text”).value=text
oFrame(“innertext”).value=itext
oFrame(“outertext”).value=otext
oFrame(“outertext”).value=otext
oFrame(“html tag”).value=htag
oFrame(“index”).value=index
oFrame(“class”).value=sclass
‘FrameCall
Call SGPPFrame(oFrame,act,data)
End Select
End Function
‘BroserCall Description
Function browsercall(act,data)
Select Case act
Case “iexplore”
SystemUtil.Run “iexplore.exe”,data
Reporter.ReportEvent micPass,””,”Internet Explorer browser is opened”
Case “Firefox”
SystemUtil.Run “Firefox.exe”,data
Reporter.ReportEvent micPass,””,”Firefox browser is opened”
Case “Chrome”
SystemUtil.Run “chrome.exe”,data
Reporter.ReportEvent micPass,””,”Chrome browser is opened”
Case Else
SystemUtil.Run “iexplore.exe”,data
Reporter.ReportEvent micPass,””,”Else Part Internet Explorer browser is opened”
End Select
End Function

‘WebEditCall Description
Function SGPPWebEdit(oWebEdit,act,data)
Select Case act

Case “Set”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set data
Reporter.ReportEvent micPass, “oWebEdit”, data &” is entered.”
Else
Reporter.ReportEvent micFail, “oWebEdit”, data &” is not entered.”
End If
Case “Empty”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Exist Then
valTXT=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).GetRoProperty(“value”)
If valTXT=”” Then
Dim inputdata
inputdata=InputBox(“Please Enter the Correct data”)
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set inputdata
End If
Reporter.ReportEvent micPass, “oWebEdit”, inputdata &” is entered.”
Else
Reporter.ReportEvent micFail, “oWebEdit”, inputdata &” is not entered.”
End If

Case “SetSecure”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).SetSecure data
Reporter.ReportEvent micPass, “oWebEdit”, data &” is entered.”
Else
Reporter.ReportEvent micFail, “oWebEdit”, data &” is not entered.”
End If
Case “Submit”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Submit
Reporter.ReportEvent micPass, “oWebEdit”, ” WebEdit is Submitted.”
Else
Reporter.ReportEvent micFail, “oWebEdit”, ” WebEdit is not Submitted”
End If
Case “Click”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Click
Reporter.ReportEvent micPass, “WebEdit”,”WebEdit is Clicked”
Else
Reporter.ReportEvent micFail, “WebEdit”,”WebEdit is not Clicked”
End If
Case “Display”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Exist Then
Reporter.ReportEvent micPass, “oWebEdit”, “Text Field is displaying or present”
Else
Reporter.ReportEvent micFail, “oWebEdit”, “Text Field is not displaying”
End If

Case “Length”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set data
data=Len(data)
limit=sdata
msgbox limit
msgbox data
If data > limit Then
Reporter.ReportEvent micPass, “oWebEdit”, “The string length is “&data&” exceeded the “&limit
If Dialog(“text:=Message from webpage”).Exist Then
Dialog(“text:=Message from webpage”).Activate
Dialog(“text:=Message from webpage”).WinButton(“text:=OK”).Click
Reporter.ReportEvent micPass, “oWebEdit”, “Alert-Box is present for the string length is exceeded the limit”
Else
Reporter.ReportEvent micFail, “oWebEdit”, “Alert-Box is not present for the string length is not exceeded the limit”
End If
Reporter.ReportEvent micFail, “oWebEdit”, “The string length is “&data&” exceeded the “&limit
Else
End If

Case “Numeric”
‘ Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set data
val=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).GetROProperty(“value”)
If IsNumeric(val) Then
Reporter.ReportEvent micPass, “oWebEdit”, “Only Numeric is present”
Else
Reporter.ReportEvent micFail, “oWebEdit”, “Non Numeric also present”
End If

Case “Alpha”
‘ Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set data
val=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).GetROProperty(“value”)
set reNonAplha = new RegExp
reNonAplha.pattern = “[^A-Za-z]”
If reNonAplha.test(val) Then
Reporter.ReportEvent micFail, “oWebEdit”, “The string is non-alpha”
Else
Reporter.ReportEvent micPass, “oWebEdit”, “The string is only alpha”
End If

Case “SpecialChar”
‘ Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set data
val=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).GetROProperty(“value”)
set reNonAplha = new RegExp
reNonAplha.pattern = “[(?*””,\\<>&#~%{}+_.@:\/!;]+”
If reNonAplha.test(val) Then
Reporter.ReportEvent micPass, “oWebEdit”, “Special Char is presentt”
Else
Reporter.ReportEvent micFail, “oWebEdit”, “Special Char is not Present”
End If

Case “TypeName”
‘ Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).Set data
val=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(oWebEdit).GetROProperty(“value”)
dtype=TypeName(val)
Select Case dtype
Case “Integer”
Reporter.ReportEvent micPass, “”, dtype&” is present”
Case “Double”
Reporter.ReportEvent micPass, “”, dtype&” is present”
Case “String”
Reporter.ReportEvent micPass, “”, dtype&” is present”
Case Else
Reporter.ReportEvent micPass, “”, dtype&” is present”
End Select

Case “Alert”
If dBrowser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Exist Then
dBrowser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Activate
dBrowser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WinButton(“text:=OK”).Click
Reporter.ReportEvent micPass, “oWebEdit”, “Alert-Box is presentt”
Else
Reporter.ReportEvent micFail, “oWebEdit”, “Alert-Box is not present”
End If

End Select
End Function

‘WebButtonCall Description
Function SGPPWebButtont(oWebButton,act,data)
Select Case act
Case “Display”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Exist Then
Reporter.ReportEvent micPass, “oWebButton”, “WebButton is displaying or present”
Else
Reporter.ReportEvent micFail, “oWebButton”, “WebButton is not displaying”
End If

Case “Click”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Click
Reporter.ReportEvent micPass, “oWebButton”,”WebButton is Clicked”
Else
Reporter.ReportEvent micFail, “oWebButton”,”WebButton is not exist and not clicked”
End If

Case “FireEvent”
Setting.WebPackage(“ReplayType”) = 2
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).FireEvent data
Setting.WebPackage(“ReplayType”) = 2

Case “Color”
color= Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.color
Reporter.ReportEvent micPass, “oWebElement”,color & ” color is displaying”
Case “BGColor”
bgcolor=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.backgroundColor
Reporter.ReportEvent micPass, “oWebElement”,bgcolor & ” Background color is displaying”
Case “FSize”
fsize=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.fontSize
Reporter.ReportEvent micPass, “oWebElement”,fsize & ” Font Size is displaying”
Case “FStyle”
fstyle=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.fontStyle
Reporter.ReportEvent micPass, “oWebElement”,fstyle & ” Font Style is displaying”
Case “FFamily”
ffamily=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.fontFamily
Reporter.ReportEvent micPass, “oWebElement”,ffamily & ” Font Family is displaying”
Case “SWeight”
fweight=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.fontWeight
Reporter.ReportEvent micPass, “oWebElement”,fweight & ” Font Weight is displaying”
Case “TextAlign”
talign=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(oWebButton).Object.currentStyle.textAlign
Reporter.ReportEvent micPass, “oWebElement”,talign & ” Align is displaying”
Case Else

End Select
End Function

‘LinkCall Description
Function SGPPLink(oLink,act,data)
Select Case act
Case “Display”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Exist Then
Reporter.ReportEvent micPass, “oLink”, “Link is displaying or present”
Else
Reporter.ReportEvent micFail, “oLink”, “Link is not displaying”
End If
Case “Click”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Click
Reporter.ReportEvent micPass,”oLink”,”Link is Clicked”
Else
Reporter.ReportEvent micFail, “oLink”,”Link is not clicked and not exist”
End If

Case “FireEvent”
Setting.WebPackage(“ReplayType”) = 2
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).FireEvent data
Setting.WebPackage(“ReplayType”) = 2

Case “Color”
color= Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.color
Reporter.ReportEvent micPass, “oWebElement”,color & ” color is displaying”
Case “BGColor”
bgcolor=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.backgroundColor
Reporter.ReportEvent micPass, “oWebElement”,bgcolor & ” Background color is displaying”
Case “FSize”
fsize=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.fontSize
Reporter.ReportEvent micPass, “oWebElement”,fsize & ” Font Size is displaying”
Case “FStyle”
fstyle=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.fontStyle
Reporter.ReportEvent micPass, “oWebElement”,fstyle & ” Font Style is displaying”
Case “FFamily”
ffamily=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.fontFamily
Reporter.ReportEvent micPass, “oWebElement”,ffamily & ” Font Family is displaying”
Case “SWeight”
fweight=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.fontWeight
Reporter.ReportEvent micPass, “oWebElement”,fweight & ” Font Weight is displaying”
Case “TextAlign”
talign=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(oLink).Object.currentStyle.textAlign
Reporter.ReportEvent micPass, “oWebElement”,talign & ” Align is displaying”

Case Else

End Select
End Function

‘WebList Call Description
Function SGPPWebList(oWebList,act,data)
Select Case act
Case “Display”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Exist Then
Reporter.ReportEvent micPass, “oWebList”, “WebList is displaying or present”
Else
Reporter.ReportEvent micFail, “oWebList”, “WebList is not displaying”
End If
Case “Random”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Exist Then
Itemcount=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).GetROProperty(“items count”)
‘ select random value from product drop down field
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Select “#” & RandomNumber.value(1, Itemcount -1)
Reporter.ReportEvent micPass, “oWebList”,”WebList is randomely selected”
Else
Reporter.ReportEvent micFail, “oWebList”,”Weblist is not selected and not exist”
End If

Case “Specific”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Exist Then
Itemcount=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).GetROProperty(“items count”)
If Itemcount > data Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Select “#”&data
End If
Reporter.ReportEvent micPass, “oWebList”,”WebList is selected in specific manner”
Else
Reporter.ReportEvent micFail, “oWebList”,”WebList is not selected is specific manner”
End If

Case “Color”
color= Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.color
Reporter.ReportEvent micPass, “oWebElement”,color & ” color is displaying”
Case “BGColor”
bgcolor=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.backgroundColor
Reporter.ReportEvent micPass, “oWebElement”,bgcolor & ” Background color is displaying”
Case “FSize”
fsize=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.fontSize
Reporter.ReportEvent micPass, “oWebElement”,fsize & ” Font Size is displaying”
Case “FStyle”
fstyle=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.fontStyle
Reporter.ReportEvent micPass, “oWebElement”,fstyle & ” Font Style is displaying”
Case “FFamily”
ffamily=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.fontFamily
Reporter.ReportEvent micPass, “oWebElement”,ffamily & ” Font Family is displaying”
Case “SWeight”
fweight=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.fontWeight
Reporter.ReportEvent micPass, “oWebElement”,fweight & ” Font Weight is displaying”
Case “TextAlign”
talign=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebList(oWebList).Object.currentStyle.textAlign
Reporter.ReportEvent micPass, “oWebElement”,talign & ” Align is displaying”
Case Else

End Select
End Function
Function SGPPWebElement(oWebElement,act,data)
Select Case act
Case “FireEvent”
Setting.WebPackage(“ReplayType”) = 2
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Link(“text:=India Net Neutrality”).FireEvent data
Setting.WebPackage(“ReplayType”) = 2
Case “Sync”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Sync
Case “Color”
color= Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.color
Reporter.ReportEvent micPass, “oWebElement”,color & ” color is displaying”
Call color_name(color)
Case “BGColor”
bgcolor=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.backgroundColor
Reporter.ReportEvent micPass, “oWebElement”,bgcolor & ” Background color is displaying”
Case “FSize”
fsize=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.fontSize
Reporter.ReportEvent micPass, “oWebElement”,fsize & ” Font Size is displaying”
Case “FStyle”
fstyle=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.fontStyle
Reporter.ReportEvent micPass, “oWebElement”,fstyle & ” Font Style is displaying”
Case “FFamily”
ffamily=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.fontFamily
Reporter.ReportEvent micPass, “oWebElement”,ffamily & ” Font Family is displaying”
Case “SWeight”
fweight=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.fontWeight
Reporter.ReportEvent micPass, “oWebElement”,fweight & ” Font Weight is displaying”
Case “TextAlign”
talign=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(oWebElement).Object.currentStyle.textAlign
Reporter.ReportEvent micPass, “oWebElement”,talign & ” Align is displaying”
Case Else

End Select
End Function

Function SGPPWebCheckBox(oWebCheckBox,act,data)
Select Case act
Case “Specific”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebCheckBox(oWebCheckBox).Exist Then
data=data
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebCheckBox(oWebCheckBox).Set data
Reporter.ReportEvent micPass, “oWebCheckBox”, data &” WebCheckBox is setted in specific manner”
Else
Reporter.ReportEvent micFail, “oWebCheckBox”, data &” WebCheckBox is not setted in specific manner”
End If
End Select
End Function

Function SGPPWebRadioGroup(oWebRadioGroup,act,data)
Select Case act
Case “Display”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Exist Then
Reporter.ReportEvent micPass, “oWebRadioGroup”, “WebRadioGroup is displaying or present”
Else
Reporter.ReportEvent micFail, “oWebRadioGroup”, “WebRadioGroup is not displaying”
End If
Case “Random”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Exist Then
‘Here u should pass common properties for all radio’s button
itemcount=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).GetROProperty(“items count”)
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Select “#” & RandomNumber.value(1, itemcount -1)
End If

Case “Specific”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Exist Then
‘ Itemcount=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).GetROProperty(“items count”)
‘ If Itemcount > data Then
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Select “#1”
Reporter.ReportEvent micPass, “oWebRadioGroup”,”WebRadioGroup is Selected in specific manner”
Else
Reporter.ReportEvent micFail, “oWebRadioGroup”,”WebRadioGroup is Selected in specific manner and not exist”
End If

‘ End If
End If

Case Else

End Select
End Function
Function SGPPWebTable(oWebTable,act,data,citem,rows,cols,index)
Select Case act
Case “Display”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Exist Then
Reporter.ReportEvent micPass, “oWebTable”, “WebTable is displaying or present”
Else
Reporter.ReportEvent micFail, “oWebTable”, “WebTable is not displaying”
End If
Case “Click”
‘ msgbox Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).RowCount
‘ msgbox Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ColumnCount(1)
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ChildItem(rows,cols,citem,index).Click
Reporter.ReportEvent micFail, “oWebTable”,”WebTable is Clicked”
Else
Reporter.ReportEvent micFail, “oWebTable”,”WebTable is not clicked and not exist”
End If

Case “Select”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ChildItem(rows,cols,data,index).Select “#1”
Reporter.ReportEvent micFail, “oWebTable”,”WebTable is Selected”
Else
Reporter.ReportEvent micFail, “oWebTable”,”WebTable is not Selected and not exist”
End If
” txt=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ChildItem(rows,cols,data,index).GetROProperty(“items count”)
‘ rowcount=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).RowCount
‘ colscount= Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ColumnCount(1)
‘ If rowcount < 0 Then
‘ msgbox “List is Empty”
‘ else
” itemcount=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).GetROProperty(“items count”)
” Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebRadioGroup(oWebRadioGroup).Select “#” & RandomNumber.value(1, itemcount -1)
‘ Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ChildItem(rows,cols,data,index).Select “#1″ ””””””””””’Need to change #1 to dynamic
‘ End If
Case “Set”
If Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Exist Then
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).ChildItem(rows,cols,citem,index).Set data
Reporter.ReportEvent micFail, “oWebTable”,”WebTable is setted”
Else
Reporter.ReportEvent micFail, “oWebTable”,”WebTable is not setted and not exist”
End If

Case “Color”
color= Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.color
Reporter.ReportEvent micPass, “oWebElement”,color & ” color is displaying”
Case “BGColor”
bgcolor=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.backgroundColor
Reporter.ReportEvent micPass, “oWebElement”,bgcolor & ” Background color is displaying”
Case “FSize”
fsize=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.fontSize
Reporter.ReportEvent micPass, “oWebElement”,fsize & ” Font Size is displaying”
Case “FStyle”
fstyle=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.fontStyle
Reporter.ReportEvent micPass, “oWebElement”,fstyle & ” Font Style is displaying”
Case “FFamily”
ffamily=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.fontFamily
Reporter.ReportEvent micPass, “oWebElement”,ffamily & ” Font Family is displaying”
Case “SWeight”
fweight=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.fontWeight
Reporter.ReportEvent micPass, “oWebElement”,fweight & ” Font Weight is displaying”
Case “TextAlign”
talign=Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(oWebTable).Object.currentStyle.textAlign
Reporter.ReportEvent micPass, “oWebElement”,talign & ” Align is displaying”

End Select
End Function

”Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebElement(“innertext:=Double-click this paragraph to trigger a function.”).FireEvent -> For Frame

Function SGPPFrame(oFrame,act,data)
Select Case method
Case “WebEdit”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebEdit(oFrame).Set data
Case “WebElement”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebElement(oFrame).Set data
Case “WebList”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebList(oFrame).Select “#1”
Case “WebCheckBox”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebElement(oFrame).Select “#1”
Case “WebButton”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebButton(oFrame).Click
Case “Link”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).Link(oFrame).Click
Case “WebCheckBox”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebCheckBox(oFrame).Select “#1”
Case “WebTable”
Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).Frame(“html id:=iframeResult”).WebTable(oWebTable).ChildItem(rows,cols,data,index).Select “#1″

End Select
End Function

On Error Goto 0

objExcel.ActiveWorkbook.Close

”Close Excel
objExcel.Application.Quit

Set objWorksheet =nothing
Set objExcel = nothing

‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebTable(“name:=Date Added”).ChildItem(2,9,”WebButton”,0).Click

‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(“name:=Add New Complaint”,”index:=0″).Click
‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(“name:=Add New Complaint”).Click

‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(“html id:=voucher_code_0”).Set “2654”
‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebEdit(“html id:=voucher_amount_0”).Set “2”
‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebButton(“name:=Add More”).Click

‘Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(“innertext:=Use this screen to detail, categorise and investigate your complaints.”,”class:=content_text1″).Object.currentStyle.color
Dim ctrlWebEl, objWebEl

msgbox Browser(“title:=Welcome to QADEX”).Page(“title:=Welcome to QADEX”).WebElement(“innertext:=Line”,”class:=content_text1″).Object.currentStyle.textAlign
Set objWebEl = ctrlWebEl.Object

msgbox objWebEl.currentStyle.textAlign
msgbox objWebEl.currentStyle.color
msgbox objWebEl.currentStyle.backgroundColor
msgbox objWebEl.currentStyle.fontSize
msgbox objWebEl.currentStyle.fontStyle
msgbox objWebEl.currentStyle.fontFamily
msgbox objWebEl.currentStyle.fontWeight

Dim d, msg ‘ Create some variables.
Set d = CreateObject(“Scripting.Dictionary”)
d.Add “a”, “Apple” ‘ Add some keys and items.
d.Add “b”, “BlueTooth”
d.Add “c”, “C++”
For i = 0 to d.Count – 1

If d.Exists(“c”) Then
keys = d.Keys

msgbox Keys(i) & ” = ” & d.item(Keys(i))

End If
next
Function color_name(color)
msgbox “Function called”
Dim d, msg ‘ Create some variables.
Set d = CreateObject(“Scripting.Dictionary”)
d.Add “#000000”, “black” ‘ Add some keys and items.
d.Add “b”, “BlueTooth”
d.Add “c”, “C++”
msgbox color
c=CInt(color)

If d.Exists(c) Then
msgbox c
keys = d.Keys
msgbox d.item(Keys(c))
msgbox “If Exit”
End If
End Function

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s