自動化開發測試框架

此文章轉的

此框架是從SAFFRON框架改的,據作者說是優化版,收了,以後查用。不錯的自動化開發測試框架。

 

‘***************************************************************************************************************************************
'定義全局變量以便於該框架函數WorkUnderFrame 的運行,否則變量無法共享傳遞
‘***************************************************************************************************************************************
Dim frameDesc:frameDesc = ""
Dim objectArray:objectArray =
Split("Link,WebButton,WebList,WebEdit,Image,WebTable,Viewlink,WebArea,WebCheckBox,WebFile,WebRadioGroup,WebElement", ",")
‘***************************************************************************************************************************************
'設計說明:關閉所有打開的IE,避免使用CloseProcessByName 這種容易造成IE 崩潰的粗魯辦法
'程序輸入:無
'程序輸出:無
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:CloseAllOpenedBrowsers
‘***************************************************************************************************************************************
Public Sub CloseAllOpenedBrowsers
Set Wshshell = CreateObject("Wscript.Shell")
Set DialogObject = Description.Create()
DialogObject("micclass").Value = "Dialog"
Set Windows32Dialog = Desktop.ChildObjects(DialogObject)
dlNum = Windows32Dialog.Count - 1
For v = 0 to dlNum
Windows32Dialog(v).Close
Next
Set Windows32Dialog = Nothing
Set theBrowser = Browser("micclass:=Browser", "index:=0")
While theBrowser.Exist(0)
theBrowser.Close
waitNx = 1
Do While waitNx < 5
Set Windows32Dialog = Desktop.ChildObjects(DialogObject)
dlNum = Windows32Dialog.Count - 1
For v = 0 to dlNum
dlText = Windows32Dialog(v).GetROProperty("regexpwndtitle")
Wshshell.AppActivate(dlText)
Wait(1)
Wshshell.SendKeys "{ENTER}"
Next
Set Windows32Dialog = Nothing
waitNx = waitNx + 1
Loop
Report micPass,"使用CloseAllOpenedBrowsers 函數頁面關閉成功","當前頁面關閉成功!"
Wend
Set theBrowser = Nothing
Set DialogObject = Nothing
Set Wshshell = Nothing
End Sub
‘***************************************************************************************************************************************
'設計說明:最大化IE 瀏覽器
'程序輸入:無
'程序輸出:無
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:MaximizeBrowser
‘***************************************************************************************************************************************
Public Sub MaximizeBrowser
Set BrowserObject = Description.Create()
BrowserObject("NativeClass").Value = "IEFrame"
Set WindowsBrowser = Desktop.ChildObjects(BrowserObject)
brNum = WindowsBrowser.Count - 1
For i = 0 To brNum
ieVersion = WindowsBrowser(i).GetROProperty("version")
wndTitle = WindowsBrowser(i).GetROProperty("title")
Set ObjectBrowser = Browser("micclass:=Browser", "index:=" & i)
If Instr(ieVersion,6) > 0 Then
Window("regexpwndclass:=IEFrame","index:=0","text:=" & wndTitle & ".*").Maximize
Else
WindowsBrowser(i).Maximize
End If
Set ObjectBrowser = Nothing
Next
Set WindowsBrowser = Nothing
Set BrowserObject = Nothing
End Sub
‘***************************************************************************************************************************************
'設計說明:初始化所有打開的Browser 頁面
'程序輸入:無
'程序輸出:初始化成功或者失敗
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:BrowserSync
‘***************************************************************************************************************************************
Public Function SyncronizeBrowser()
Dim bolVal1:bolVal1 = False
Dim bolVal2:bolVal2 = False
Dim bolVal3:bolVal3 = False
Dim bolVal4:bolVal4 = False
Dim binx:binx = 0
Dim ex:ex = 0
If Browser("micclass:=Browser", "CreationTime:=0").Exist(0) Then
Browser("micclass:=Browser", "CreationTime:=0").Sync
Else
SyncronizeBrowser = False
Report micWarning ,"初始化頁面失敗","頁面初始化失敗,需要重新操作!"
Exit Function
End If
Set BrowserObject = Description.Create()
BrowserObject("micclass").Value = "Browser"
Set WindowsBrowser = Desktop.ChildObjects(BrowserObject)
For binx = 0 to WindowsBrowser.Count - 1
WindowsBrowser(binx).Sync
Do Until ex = 10
bolVal1 = (WindowsBrowser(binx).GetROProperty("url") <> "")
bolVal2 = WindowsBrowser(binx).GetROProperty("openurl") <> ""
bolVal3 = WindowsBrowser(binx).GetROProperty("name") <> ""
bolVal4 = WindowsBrowser(binx).GetROProperty("title") <> ""
If (bolVal1 And bolVal3) Or (bolVal1 And bolVal4) Or (bolVal2 And bolVal3) Or (bolVal2 And bolVal4) Then
Exit Do
Else
Wait(1)
End If
ex = ex + 1
Loop
Next
Set WindowsBrowser = Nothing
Set BrowserObject = Nothing
SyncronizeBrowser = True
End Function
‘***************************************************************************************************************************************
'設計說明:打開指定的地址,並且初始化頁面,特別說明:對於地址欄出現一次性sessionid 的網頁不可用該函數
'程序輸入:url 地址
'程序輸出:初始化成功或者失敗
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:print NavigateBrowser ("www.baidu.com")
‘***************************************************************************************************************************************
Public Function NavigateBrowser(para_myuri)
CloseAllOpenedBrowsers
Set IEBrowser = CreateObject("InternetExplorer.Application")
IEBrowser.Visible = True
IEBrowser.Navigate para_myuri
Set ObjectBrowser = Browser("micclass:=Browser", "index:=0")
Do Until SyncronizeBrowser() = True
Wait(1)
Loop
actualurl = ObjectBrowser.GetROProperty("url")
'下面這個判斷主要是爲了解決初始化地址跳轉問題,如果URL 發生變化會導致對象屬性發生變化從而導致運行錯誤。
If actualurl <> para_myuri Then
ObjectBrowser.Close
Set IEBrowser = Nothing
Set IEBrowser = CreateObject("InternetExplorer.Application")
IEBrowser.Visible = True
IEBrowser.Navigate actualurl
If Not SyncronizeBrowser() Then
Report MicWarning,"使用NavigateBrowser 函數IE 初始化失敗","打開指定頁面【" & para_myuri & "】在初始化的時候失敗!"
Set MyBrowser = Nothing
Set IEBrowser = Nothing
Exit Function
End If
End If
Set ObjectBrowser = Nothing
Set IEBrowser = Nothing
Report MicPass,"使用NavigateBrowser 函數IE 初始化成功","打開指定頁面【" & para_myuri & "】並且初始化成功!"
NavigateBrowser = True
End Function
‘***************************************************************************************************************************************
'設計說明:處理彈出對話框,主要用於彈出的可預知性能夠得到控制的地方,未知彈出需引用其他函數處理
'程序輸入:選擇對話框操作:是/否/確認/取消/確定等等,是否需要向結果中添加提示信息的報告
'程序輸出:結果報告
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:HandleDialog "確.*定","Y"
‘***************************************************************************************************************************************
Public Function HandleDialog(btText,needAlertInfo)
Dim buttonName:buttonName = ""
Dim btName:btName = ""
Dim binx:binx = 0
Dim inx:inx = 0
Dim dialogTitle:dialogTitle = ""
If Trim(btText) = "" Then
buttonName = "任意按鈕"
Else
buttonName = btText
End If
Set Wshshell = CreateObject("Wscript.Shell")
Set DialogObject = Description.Create()
DialogObject("micclass").Value = "Dialog"
Set WindowsDialog = Desktop.ChildObjects(DialogObject)
If WindowsDialog.Count - 1 < 0 Then
Set WindowsDialog = Nothing
Set DialogObject = Nothing
Set Wshshell = Nothing
Report micDone,"已經沒有任何彈出框","不需要進行對話框處理!"
Exit Function
End If
For inx = 0 to WindowsDialog.Count - 1
If needAlertInfo = "Y" Or needAlertInfo = True Then
Set StaticObject = Description.Create()
StaticObject("micclass").Value = "Static"
Set WindowsStatic = WindowsDialog(inx).ChildObjects(StaticObject)
disMessage = WindowsStatic(WindowsStatic.Count - 1).GetROProperty("text")
Report micDone,"獲取網頁對話框信息成功:",disMessage
Set WindowsStatic = Nothing
Set StaticObject = Nothing
End If
Set WinButtonObject = Description.Create()
WinButtonObject("micclass").Value = "WinButton"
Set WindowsButton = WindowsDialog(inx).ChildObjects(WinButtonObject)
Do While binx <= WindowsButton.Count - 1
btName = Trim(WindowsButton(binx).GetROProperty("text")) & "任意按鈕"
If Instr(btName,buttonName) > 0 Then
WindowsButton(binx).Click
Report micDone,"函數HandleDialog 點擊指定按鈕成功","按照指定的按鈕名稱【" & btText & "】查找並點擊按鈕成功!"
Exit Do
End If
binx= binx + 1
Loop
Set WindowsButton = Nothing
Set WinButtonObject = Nothing
Next
Set WindowsDialog = Nothing
Set DialogObject = Nothing
Set Wshshell = Nothing
End Function
‘***************************************************************************************************************************************
'設計說明:爲Browser、Window、Page、Frame 生成描述性語言,爲後續做執行用,從SAFFRON 改造得來
'程序輸入:1.當前操作頁面在所有打開的頁面中的排序(從1 開始),2.是否模態窗口
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:GenerateDescription (2,"N")
‘***************************************************************************************************************************************
Public Function GenerateDescription (brNumber,ifModule)
Dim brinx:brinx = brNumber - 1
Dim windex:windex = ""
Dim bindex:bindex = ""
Dim descString:descString = ""
If ifModule = "Y" Or ifModule = True Then
descString = "Window(" & Quote("nativeclass:=Internet Explorer_TridentDlgFrame") & "," & Quote("Location:=0") & ")." & "Page(" &
Quote("micclass:=Page") & "," & Quote("index:=0") & ")."
Else
bindex = "CreationTime:=" & brinx
descString = "Browser(" & Quote("micclass:=Browser") & "," & Quote(bindex) & ")." & "Page(" & Quote("micclass:=Page") & "," &
Quote("index:=0") & ")."
End If
descString = descString & frameDesc
GenerateDescription = descString
End Function
‘***************************************************************************************************************************************
'設計說明:爲WEB 其他實例對象生成描述性語言,爲後續做執行用,從SAFFRON 改造得來
'程序輸入:1.對象類名,2.指定的屬性和值比如"name:=姓名"
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:GenerateobjectDescription ("Link","text:=Name")
‘***************************************************************************************************************************************
Public Function GenerateObjectDescription (objClassName, otherAtt)
Dim objNameString:objNameString = ""
Dim objNx:objNx = IndexOf(objectArray, objClassName)
If objNx >= 0 Then
objNameString = objClassName & "(" & Quote("micclass:=" & objClassName) & "," & Quote(otherAtt) & "," & Quote("index:=0") & ")"
End If
GenerateobjectDescription = objNameString
End Function
‘***************************************************************************************************************************************
'設計說明:爲每一種Web 類生成對象,
'程序輸入:1.類名,2.關鍵識別屬性:Link、WebElement、Viewlink、WebTable 使用innertext 屬性,支持右模糊匹配
'Window 使用text、Browser 使用title,Page 無需特別標註,其餘皆使用name,支持左中右模糊匹配3.頁面層次序號,4.
是否模態窗口
'程序輸出:Web 對象,支持後續的QTP 內置方法
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:msgbox GenerateSpecifiedObject("WebTable","搜索開放平臺",1,"N").GetROProperty("text")
‘***************************************************************************************************************************************
Public Function GenerateSpecifiedObject (className, attValue, brNumber, ifModule)
Dim objectString:objectString = ""
Dim textDesc: textDesc = ""
Dim MySpecifiedObject:MySpecifiedObject = ""
Dim blVal1:blVal1 = (UCase(className) = "LINK")
Dim blVal2:blVal2 = (UCase(className) = "WEBELEMENT")
Dim blVal3:blVal3 = (UCase(className) = "VIEWLINK")
Dim blVal4:blVal4 = (UCase(className) = "WEBTABLE")
If blVal1 Or blVal2 Or blVal3 Or blVal4 Then
textDesc = "innertext:=" & attValue & ".*"
objectString = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription(className, textDesc)
Execute "Set MySpecifiedObject = " & objectString
Elseif Ucase(className) = "WINDOW" Then
Set MySpecifiedObject = Window("nativeclass:=Internet Explorer_TridentDlgFrame", "text:=.*" & attValue & ".*","Location:=0")
Elseif Ucase(className) = "BROWSER" Then
Set MySpecifiedObject = Browser("micclass:=Browser", "title:=.*" & attValue & ".*","CreationTime:=0")
Elseif Ucase(className) = "PAGE" Then
textDesc = GenerateDescription(brNumber, ifModule)
Execute "Set MySpecifiedObject = " & Left(textDesc,Len(textDesc) - 1)
Else
textDesc = "name:=.*" & attValue & ".*"
objectString = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription(className, textDesc)
Execute "Set MySpecifiedObject = " & objectString
End If
Set GenerateSpecifiedObject = MySpecifiedObject
End Function
‘***************************************************************************************************************************************
'設計說明:根據關鍵字(可正則模糊)查詢頁面對象,取消SAFRRON 中對Page 和Frame 的檢查,新增Web 其他對象
'程序輸入:1.對象類名,2.內置屬性的值如“查.*詢.*”,3.頁面層次(Browser 對象)序號,4.是否模態窗口
'程序輸出:找到則返回Ture 否則爲False,並且添加結果報告
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:FindSpecifiedObject "WebTable","搜索開放平臺",1,"N"
‘***************************************************************************************************************************************
Public Function FindSpecifiedObject (objectClass, specifiedText, brNumber, ifModule)
Dim boolValue:boolValue = False
Dim specifiedAtt:specifiedAtt = ""
Dim blVal1:blVal1 = (UCase(className) = "LINK")
Dim blVal2:blVal2 = (UCase(className) = "WEBELEMENT")
Dim blVal3:blVal3 = (UCase(className) = "VIEWLINK")
Dim blVal4:blVal4 = (UCase(className) = "WEBTABLE")
If blVal1 Or blVal2 Or blVal3 Or blVal4 Then
specifiedAtt = "innertext"
Elseif Ucase(objectClass) = "WINDOW" Then
specifiedAtt = "text"
Elseif Ucase(objectClass) = "BROWSER" Or Ucase(objectClass) = "PAGE" Then
specifiedAtt = "title"
Else
specifiedAtt = "name"
End If
If GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).Exist(0) Then
objValue = GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).GetROProperty(specifiedAtt)
Report micDone, objectClass & "匹配對象成功", "對象【" & objectClass & "】【" & objValue & "】查詢成功! "
boolValue = True
Else
Report micWarning, objectClass & "匹配對象失敗", "對象【" & objectClass & "】根據關鍵字【 " & specifiedText & " 】查詢無果!"
boolValue = False
End If
Set MyObject = Nothing
FindSpecifiedObject = boolValue
End Function
‘***************************************************************************************************************************************
'設計說明:點擊網頁上可以點擊的對象,包括鏈接、按鈕、圖標、虛擬鏈接、文件上傳域、網頁不識別組件
'程序輸入:1.對象的類明,2.指定的屬性值關鍵字(可模糊匹配),3.頁面層次序號,4.是否模態窗口
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:ClickSpecifiedObject "Link","退出系統",2,"N"
‘***************************************************************************************************************************************
Public Function ClickSpecifiedObject (objectClass, specifiedText, brNumber, ifModule)
Dim boolValue:boolValue = False
Dim isDisabled:isDisabled = ""
Dim isReadonly:isReadonly = ""
Dim blVal1:blVal1 = (UCase(objectClass) <> "LINK")
Dim blVal2:blVal2 = (UCase(objectClass) <> "WEBBUTTON")
Dim blVal3:blVal3 = (UCase(objectClass) <> "IMAGE")
Dim blVal4:blVal4 = (UCase(objectClass) <> "VIEWLINK")
Dim blVal5:blVal5 = (UCase(objectClass) <> "WEBFILE")
Dim blVal6:blVal6 = (UCase(objectClass) <> "WEBELEMENT")
If blVal1 And blVal2 And blVal3 And blVal4 And blVal5 And blVal6 Then
Report MicFail,"ClickSpecifiedObject 函數參數錯誤","ClickSpecifiedObject 函數只適用於LINK、WEBBUTTON、IMAGE、VIEWLINK、
WEBFILE、WEBELEMENT,請確認!"
Exit Function
End If
If Not GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).Exist(0) Then
Report micFail, "ClickSpecifiedObject 操作失敗", "網頁對象【" & objectClass & "】按照關鍵字【" & specifiedText & "】沒有查詢到!"
boolValue = False
Else
isDisabled = GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).GetROProperty("disabled")
isReadonly = GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).GetROProperty("readonly")
If Trim(isDisabled) = "1" Or Trim(isReadonly) = "1" Then
Report micFail, "ClickSpecifiedObject 操作失敗", "網頁對象【" & objectClass & "】【" & specifiedText & "】Disabled!"
boolValue = False
Else
GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).Click
Report micDone, "函數ClickSpecifiedObject 操作點擊完成:","網頁對象【" & objectClass & "】:【" & specifiedText & "】點擊完
畢,並且已經執行網頁初始化!"
boolValue = True
SyncronizeBrowser
End If
End If
SyncronizeBrowser
ClickSpecifiedObject = boolValue
End Function
‘***************************************************************************************************************************************
'設計說明:向輸入框中輸入指定的文本
'程序輸入:1.Edit 對象name 的屬性值,2.指定的屬性值,3.頁面層次序號,4.是否模態窗口
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:PutValueToEditableArea "WebEdit","projectWorkTimes.*remark","日報明細",1,"N"
‘***************************************************************************************************************************************
Public Function PutValueToEditableArea (objectClass, nameValue, specifiedText, brNumber, ifModule)
Dim isDisabled:isDisabled = ""
Dim isReadonly:isReadonly = ""
Dim boolValue:boolValue = False
If Ucase(objectClass) <> "WEBCHECKBOX" And Ucase(objectClass) <> "WEBFILE" And Ucase(objectClass) <> "WEBEDIT"
Then
Report MicFail,"PutValueToEditableArea 函數參數錯誤","該函數只適用於WebFile、WebEdit 和WebCheckBox,請確認!"
PutValueToEditableArea = boolValue
Exit Function
Elseif Ucase(objectClass) = "WEBCHECKBOX" And (Ucase(specifiedText) <> "ON" Or Ucase(specifiedText) <> "OFF") Then
Report MicFail,"PutValueToEditableArea 函數參數錯誤","WebCheckBox 屬性值只能用ON 或OFF,請確認!"
PutValueToEditableArea = boolValue
Exit Function
Elseif Ucase(objectClass) = "WEBCHECKBOX" And (Ucase(specifiedText) = "ON" Or Ucase(specifiedText) = "OFF") Then
specifiedText = Ucase(specifiedText)
Else
specifiedText = specifiedText
End If
If Not GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).Exist(0) Then
Report micFail, "PutValueToEditableArea 操作失敗", "網頁對象【" & objectClass & "】按照關鍵字【"&nameValue&"】沒有查詢到!"
PutValueToEditableArea = boolValue
Exit Function
End If
isDisabled = GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).GetROProperty("disabled")
isReadonly = GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).GetROProperty("readonly")
nameValue = GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).GetROProperty("name")
If Trim(isReadonly) = "1" Or Trim(isDisabled) = "1" Then
Report micFail, "PutValueToEditableArea 操作失敗", "輸入框/文件瀏覽框/複選框【" & nameValue & "】已經查詢到但是不可編輯!"
boolValue = False
Else
GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).Set specifiedText
SyncronizeBrowser
Report micDone, "PutValueToEditableArea 操作成功", "文本【" & specifiedText & "】成功輸入或設置可編輯域【" & nameValue & "】!"
boolValue = True
End If
PutValueToEditableArea = boolValue
End Function
‘***************************************************************************************************************************************
'設計說明:從指定的WebList 下拉列表中選擇指定項(Trim 掉空格,不可模糊匹配)
'程序輸入:1.WebList 對象name 的屬性值,2.指定的選擇項,3.頁面層次序號,4.是否模態窗口
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:SelectFromWebList "projectWorkTimes.*remark","平安科技",1,"N"
‘***************************************************************************************************************************************
Public Function SelectFromWebList (listName, text, brNumber, ifModule)
Dim localDesc:localDesc = ""
Dim canSelect:canSelect = False
Dim boolValue:boolValue = False
localDesc = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription("WebList", "name:=.*" & listName & ".*")
Execute "Set MyWebList = " & localDesc
If Not MyWebList.Exist(0) Then
Report micFail, "SelectFromWebList", "網頁下拉列表(WebList)【" & listName & "】按照關鍵字【" & text & "】沒有查詢到!"
SelectFromWebList = boolValue
Exit Function
End If
iCount = MyWebList.GetROProperty("items count")
canMod1 = MyWebList.GetROProperty("disabled")
For i = 1 to iCount
itemValue = MyWebList.GetItem(i)
If Trim(itemValue) = Trim(text) And canMod1 = "0" Then
canSelect = True
Exit For
End If
Next
If canSelect Then
MyWebList.Select itemValue
SyncronizeBrowser
Report micDone, "下拉列表選擇成功", "選擇項【" & itemValue & "】已經被查詢到、選擇,並且執行初始化!"
boolValue = True
Else
Report micFail, "下拉列表選擇失敗", "下拉列表【" & listName & "】不可編輯!"
boolValue = False
End If
SelectFromWebList = boolValue
End Function
‘***************************************************************************************************************************************
'設計說明:按照給定的值選擇網頁單選框WebRadioGroup
'程序輸入:1.WebRadioGroup 對象name 的屬性值,2.指定的選擇項,3.頁面層次序號,4.是否模態窗口
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:SelectWebRadioGroup "remark","a",1,"N"
‘***************************************************************************************************************************************
Public Function SelectWebRadioGroup (radioName, attValue, brNumber, ifModule)
Dim localDesc:localDesc = ""
Dim canSelect:canSelect = False
Dim boolValue:boolValue = False
Dim isDisabled:isDisabled = ""
localDesc = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription("WebRadioGroup", "name:=.*" & radioName & ".*")
Execute "Set MyRadioGroup = " & localDesc
If Not MyRadioGroup.Exist(0) Then
Report micFail, "WEB 單選框查詢失敗", "單選框【" & radioName & "】按照關鍵字【" & attValue & "】沒有查詢到!"
Exit Function
Else
isDisabled = MyRadioGroup.GetROProperty("disabled")
End If
If Trim(isDisabled) = "0" Then
MyRadioGroup.Select attValue
Report micDone, "WEB 單選框選擇成功", "選擇項【" & attValue & "】已經被查詢到、選擇,並且執行初始化!"
boolValue = True
Else
Report micFail, "WEB 單選框選擇失敗", "單選框【" & radioName & "】不可選擇編輯!"
boolValue = False
End If
SyncronizeBrowser
SelectWebRadioGroup = boolValue
End Function
‘***************************************************************************************************************************************
'設計說明:指定在某個Frame 下面工作,如果不需要使用則使用另一個函數停止操作
'程序輸入:1.Frame 對象屬性名,2.指定的屬性值
'程序輸出:描述性語言字符串
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:WorkUnderFrame ("name","frameContent")
‘***************************************************************************************************************************************
Public Sub WorkUnderFrame(frameAtt,frameKey)
Dim frameDesc :frameDesc = ""
frameIdentify = frameAtt & ":=.*" & frameKey & ".*"
frameDesc = "Frame(" & Quote("micclass:=Frame") & "," & Quote(frameIdentify) & "," & Quote("index:=0") & ")."
End Sub
‘***************************************************************************************************************************************
'設計說明:將對象運行層次調到Page 下,而不在任何Frame 下
'程序輸入:
'程序輸出:將Frame 的描述性語言清空
'設計人員:LIUYI027
'設計時間:2011-01-11
'調用舉例:StopWorkUnderFrame
‘***************************************************************************************************************************************
Public Sub StopWorkUnderFrame()
frameDesc = ""
End Sub
‘***************************************************************************************************************************************
'設計說明:將字符串兩端加上雙引號,引自SAFFRON 框架
'程序輸入:字符串
'程序輸出:加了引號的字符串
'設計人員:
'設計時間:2011-01-11
'調用舉例:Quote("AAA")返回 "AAA"
‘***************************************************************************************************************************************
Public Function Quote (text)
Quote = Chr(34) & text & Chr(34)
End Function
‘***************************************************************************************************************************************
'設計說明:簡化ReportEvent 的書寫,引自SAFFRON 框架
'程序輸入:結果報告狀態
'程序輸出:結果報告
'設計人員:
'設計時間:2011-01-11
'調用舉例:Report MicPass
‘***************************************************************************************************************************************
Public Function Report (status, objtype, text)
Reporter.Filter = rtEnableAll
Reporter.ReportEvent status, objtype, text
End Function
‘***************************************************************************************************************************************
'設計說明:取字符或字符串在一個數組中的位置,引自SAFFRON 框架
'程序輸入:數組、字符串
'程序輸出:位置序號
'設計人員:
'設計時間:2011-01-11
'調用舉例:IndexOf(myArray,"something")
‘***************************************************************************************************************************************
Public Function IndexOf (myArray, myString)
myValue = -1
For i = 0 to UBound(myArray)
If myArray(i) = myString Then
myValue = i
Exit For
End If
Next
IndexOf = myValue
End Function

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章