Search This Blog

Monday, November 15, 2010

Functionality: Performs Clicks/Set/Select operation on web control passed as parameter
Public Function SelectWebContol(strWebControl,strBrowserName,strPageName,strLogcalName,strIndex ,strValue,strLogicalValue)If strIndex = "" Then
strIndex = "0"
End If
strWebControl = UCASE (strWebControl)Select Case strWebControl
Case "WEBEDITBOX"
Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).WebEdit("name:=" & strLogcalName, "index:=" & strIndex).Set strValue Exit Function
Case "WEBCHECKBOX" If strLogicalValue <> "" Then Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).WebCheckBox("name:=" & strLogcalName,"index:=" & strIndex,"value:=" & strLogicalValue).Set strValue
Exit Function
End If
Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).WebCheckBox("name:=" & strLogcalName,"index:=" & strIndex).Set strValue
Exit Function
Case "WEBLIST"
Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).WebList("name:=" & strLogcalName, "index:=" & strIndex).Select strValue Exit Function Case "WEBRADIOGROUP" Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).WebRadioGroup("name:=" & strLogcalName, "index:=" & strIndex).Select strValue
Case "IMAGE"
If Not Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).Image("alt:=" & strLogcalName,"index:=" & strIndex).Exist(3) Then Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).Image("file name:=" & strLogcalName,"index:=" & strIndex).Click Exit Function End If Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).Image("alt:=" & strLogcalName,"index:=" & strIndex).Click
Exit Function
Case "WEBBUTTON"
Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).WebButton("name:=" & strLogcalName, "index:=" & strIndex).Click
Exit Function
Case "WEBMSGBOX"
If Browser("name:=" & strBrowserName).Dialog("nativeclass:=#32770").Exist(5) Then Browser("name:=" & strBrowserName).Dialog("nativeclass:=#32770").WinButton("text:=" & strLogcalName,"index:=" & strIndex).Click
End If
Exit Function
Case "LINK" Browser("name:=" & strBrowserName ).Page("title:=" & strPageName).Link("innertext:=" & strLogcalName,"index:=" & strIndex).Click Exit Function Case Else Reporter.ReportEvent micFail, "Operation on the Control", " Operation on the web control" & strWebControl & " is failed" End SelectEnd Function

No comments:

Post a Comment