-
Notifications
You must be signed in to change notification settings - Fork 0
/
cls_WebObjects_Class.qfl
2241 lines (2137 loc) · 172 KB
/
cls_WebObjects_Class.qfl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Public WebList, WebRadioGroup, WebButton, WebEdit, WebCheckBox, WebLink, WebElement, WebFile, WebTable, GenericObject, objFound, thisObj, strObj
Set WebList = c_WebList
Set WebRadioGroup = c_WebRadioGroup
Set WebButton = c_WebButton
Set WebEdit = c_WebEdit
Set WebCheckBox = c_WebCheckBox
Set WebLink = c_WebLink
Set WebElement = c_WebElement
Set WebFile = c_WebFile
Set WebTable = c_WebTable
Set GenericObject = c_GenericObject
'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Class c_WebObject
'------------------------------------------------------------------
Private Sub Class_Initialize()
Dim blnAlreadyInit
On Error Resume Next
blnAlreadyInit = IsObject(Environment("OR"))
If Err.Number <> 0 Then blnAlreadyInit = False
On Error Goto 0
If blnAlreadyInit = True Then
If Environment("OR") Is Nothing Then
blnAlreadyInit = False
End If
End If
If blnAlreadyInit = False Then
Environment("OR") = CreateObject("Microsoft.XMLDOM")
LoadOR
End If
End Sub
'------------------------------------------------------------------
Private Sub LoadOR()
Dim strORPath
Dim iOR
Dim arrSplit
iOR = RepositoriesCollection.Count
If iOR > 1 Then
Reporter.ReportEvent micFail, "LoadOR Error", "More than one OR is associated with the test. Please merge ORs so only 1 OR is associated. Aborting..."
ExitTest
End If
arrSplit = Split(CStr(RepositoriesCollection.Item(1)), "\")
strORPath = PathFinder.Locate(CStr(arrSplit(UBound(arrSplit))))
strORPath = Replace(strORPath, "tsr", "xml")
Environment("OR").Load(strORPath)
End Sub
'------------------------------------------------------------------
Private Function FindObjectByClass (ByVal LogicalName, ByVal strClassName, ByVal strValidate, ByVal strCheckDisabled)
Dim strTemp
Dim iCount
Dim xml, xmlSearch, xmlAttr
Dim arrObjects()
Dim strParent
iCount = 0
strTemp = strClassName & "(" & Chr(34) & LogicalName & Chr(34) & ")"
Set xmlSearch = Environment("OR").getElementsByTagName("qtpRep:Object")
For i = 0 To xmlSearch.Length - 1
Set xmlAttr = xmlSearch.Item(i).Attributes
If xmlAttr.Item(0).nodeTypedValue = strClassName And xmlAttr.Item(1).nodeValue = LogicalName Then
Set strParent = xmlSearch.Item(i).parentNode.parentNode
strTemp = strParent.Attributes.Item(0).nodeValue & "(" & Chr(34) & strParent.Attributes.Item(1).nodeValue & Chr(34) & ")." & strTemp
GetParentPath strParent, "", strTemp
ReDim Preserve arrObjects(iCount)
arrObjects(iCount) = strObj
strObj = ""
strTemp = strClassName & "(" & Chr(34) & LogicalName & Chr(34) & ")"
iCount = iCount + 1
End If
Next
' Now Loop round the array and see which one is our object
On Error Resume Next
For Each Ele In arrObjects
Execute "Set thisObj =" & Ele
If strValidate = "Y" Then
If NotExists(thisObj, 1) = False Then
If strCheckDisabled = "Y" Then
thisObj.WaitProperty "visible", True, 2000
Do While thisObj.GetROProperty("disabled") <> 0
Wait 1
iCount = iCount + 1
If iCount > 30 Then
Reporter.ReportEvent micFail, "Object Disabled", "Found [" & strClassName & "] object with name [" & LogicalName & "] but it has been disabled for more than 30 seconds. Cannot continue, please check application."
ExitTest
End If
Loop
End If
objFound = Ele
Exit Function
End If
Else
objFound = Ele
Exit Function
End If
Next
Set strParent = Nothing
Set xmlSearch = Nothing
Set xmlAttr = Nothing
Set arrObjects = Nothing
Set strTemp = Nothing
End Function
'--------------------------------------------------------------------------------------------------------------------------------
Private Sub GetParentPath(ByRef objParent, ByVal strNew, ByVal strTemp)
Dim strParent
On Error Resume Next
Do
Set strParent = objParent.parentNode.parentNode
strNew = strParent.Attributes.Item(0).nodeValue & "(" & Chr(34) & strParent.Attributes.Item(1).nodeValue & Chr(34) & ")." & strNew
If Err Then
strObj = strNew & strTemp
Exit Sub
Else
GetParentPath strParent, strNew, strTemp
End If
Loop Until Err.Number <> 0
End Sub
'------------------------------------------------------------------
Public Function NotExists(ByRef obj, ByVal intTimeoutMSec)
Dim objTimer, iLastDefaultTimeout
iLastDefaultTimeout = Setting("DefaultTimeOut")
Setting("DefaultTimeOut") = 500
If Not IsNumeric(intTimeoutMSec) Then
intTimeoutMSec = iLastDefaultTimeout
End If
intTimeoutMSec = CInt(intTimeoutMSec)
Set objTimer = MercuryTimers.Timer("ObjectExistTimer")
objTimer.Start
Do
NotExists = Not obj.Exist(0)
If NotExists Then
objTimer.Stop
Exit Do
End If
Wait 0.250
Loop Until objTimer.ElapsedTime > intTimeoutMSec
objTimer.Stop
Setting("DefaultTimeOut") = iLastDefaultTimeout
End Function
'------------------------------------------------------------------
Public Function FindObjectByName (ByVal LogicalName)
Dim strTemp
Dim xmlSearch
Dim xmlAttr
Dim strParent
Dim arrObjects()
Dim iCount
strTemp = "(" & Chr(34) & LogicalName & Chr(34) & ")"
Set xmlSearch = Environment("OR").getElementsByTagName("qtpRep:Object")
For i = 0 To xmlSearch.Length - 1
Set xmlAttr = xmlSearch.Item(i).Attributes
If xmlAttr.Item(1).nodeValue = LogicalName Then
Set strParent = xmlSearch.Item(i).parentNode.parentNode
strTemp = strParent.Attributes.Item(0).nodeValue & "(" & Chr(34) & strParent.Attributes.Item(1).nodeValue & Chr(34) & ")." & xmlAttr.Item(0).nodeValue & strTemp
GetParentPath strParent, "", strTemp
ReDim Preserve arrObjects(iCount)
arrObjects(iCount) = strObj
strObj = ""
strTemp = "(" & Chr(34) & LogicalName & Chr(34) & ")"
iCount = iCount + 1
End If
Next
' Now Loop round the array and see which one is our object
On Error Resume Next
For Each Ele In arrObjects
Execute "Set thisObj =" & Ele
If NotExists(thisObj, 1) = False Then
objFound = Ele
Exit Function
End If
Next
End Function
'------------------------------------------------------------------
Public Function DoesObjectExist(strObjName, strObjType, iTimeout)
Dim blnWait
Dim iCount, iStart, iEnd
objFound = ""
iCount = 0
Do
strL = ""
iStart = Timer
FindObjectByClass strObjName, strObjType, "Y", "N"
If objFound <> "" Then
DoesObjectExist = True
Exit Function
Else
iEnd = Timer
If (iEnd - iStart) > iTimeout Then
DoesObjectExist = False
Exit Function
Else
Wait 1
iCount = iCount +1
End If
End If
Loop Until iCount > iTimeout
DoesObjectExist = False
End Function
'------------------------------------------------------------------
Public Function GetROProp(strObjName, strObjType, strProperty)
objFound = ""
If strProperty = "disabled" Then
FindObjectByClass strObjName, strObjType, "Y", "N"
If objFound = "" Then
Reporter.ReportEvent micFail, "Automation Error - [Get Object Property]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
End If
Else
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [Get Object Property]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
End If
End If
GetROProp = thisObj.GetROProperty(strProperty)
End Function
'------------------------------------------------------------------
Public Function GetTOProp(strObjName, strObjType, strProperty)
objFound = ""
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [Get Object Property]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
End If
GetTOProp = thisObj.GetTOProperty(strProperty)
End Function
'------------------------------------------------------------------
Public Function SetObject(strObjName, strObjType)
objFound = ""
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [Set Object]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
Else
Set SetObject = thisObj
End If
End Function
'------------------------------------------------------------------
Public Function ObjectWait(strObjName, strObjType, strProperty, strWaitValue, iWaittime)
objFound = ""
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [Object Wait]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
End If
oNativeReporter.Filter = 3
ObjectWait = thisObj.WaitProperty(strProperty, strWaitValue, iWaittime)
oNativeReporter.Filter = 1
End Function
'------------------------------------------------------------------
Public Sub SetTOProp(strObjName, strObjType, strProperty, strValue)
objFound = ""
strL = ""
FindObjectByClass strObjName, strObjType, "N", "N"
If objFound = "" Then
Reporter.ReportEvent micFail, "Automation Error - [Set TO Prop]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
Else
Execute "Set thisObj = " & objFound
End If
thisObj.SetTOProperty strProperty, strValue
End Sub
'------------------------------------------------------------------
Public Sub FireEvent(strObjName, strObjType, strEvent)
objFound = ""
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [Fire Event]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Reporter.EndReporting
ExitTest
End If
thisObj.FireEvent strEvent
thisObj.Init
End Sub
'------------------------------------------------------------------
Public Sub HighlightObject(strObjName, strObjType)
objFound = ""
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [HighlightObject]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Exit Sub
End If
thisObj.Highlight
End Sub
'------------------------------------------------------------------
Public Sub ObjectInit(strObjName, strObjType)
objFound = ""
If DoesObjectExist(strObjName, strObjType, 5) = False Then
Reporter.ReportEvent micFail, "Automation Error - [HighlightObject]", "The object [" & strObjName & "] of object type [" & strObjType & "] could not be found, please check."
Exit Sub
End If
thisObj.Init
End Sub
'------------------------------------------------------------------
Public Function DPObject(strObjDesc, strObjType)
Dim objDesc, objFrameDesc, objFrames, objFrame, objCollection
Dim blnFound
Set objFrameDesc = Description.Create()
objFrameDesc("micclass").Value = "Frame"
Set objDesc = Description.Create()
Select Case strObjType
Case "WebList"
objDesc("micclass").Value = "WebList"
objDesc("html tag").Value = "SELECT"
Case "WebEdit"
objDesc("micclass").Value = "WebEdit"
objDesc("html tag").Value = "INPUT"
Case "WebButton"
objDesc("micclass").Value = "WebButton"
objDesc("html tag").Value = "BUTTON"
Case "WebCheckBox"
objDesc("micclass").Value = "WebCheckBox"
objDesc("html tag").Value = "INPUT"
Case "WebRadioGroup"
objDesc("micclass").Value = "WebRadioGroup"
objDesc("html tag").Value = "INPUT"
Case "WebLink"
objDesc("micclass").Value = "Link"
objDesc("html tag").Value = "A"
Case "WebFile"
objDesc("micclass").Value = "WebFile"
objDesc("html tag").Value = "INPUT"
Case "WebTable"
objDesc("micclass").Value = "WebTable"
objDesc("html tag").Value = "TABLE"
Case "WebElement"
objDesc("micclass").Value = "WebElement"
End Select
' Split the string by the | chars
arrSplit = Split(strObjDesc, "|")
For Each First In arrSplit
' Now Split key value pairs
arrKeys = Split(First, ":=")
' Add key/value pairs to description object
objDesc(arrKeys(0)).Value = arrKeys(1)
Next
' Get all the frames on screen
Set objFrames = Browser("creationtime:=0").Page("micclass:=Page").ChildObjects(objFrameDesc)
For i = 0 To objFrames.Count -1
Set objFrame = objFrames.Item(i)
Set objCollection = objFrame.ChildObjects(objDesc)
If objCollection.Count > 0 Then
For j = 0 To objCollection.Count -1
Set thisObj = objCollection.Item(j)
If thisObj.Exist(1) Then
Set DPObject = thisObj
Exit Function
Else
blnFound = False
End If
Next
End If
Next
If blnFound = False Then
Set DPObject = Nothing
'Reporter.ReportEvent micFail, "DP Object Not Found", "The DP Object with descriptive properties of [" & strObjDesc & "] of object type [" & strObjType & "] could not be found. Please check your descriptive properties. Aborting..."
'Reporter.EndReporting
'ExitTest
End If
End Function
'------------------------------------------------------------------
Public Sub HandlePopUp(strAction)
Dim objDesc, objWindowDesc, objButtonDesc, objButtons
Dim strButtonName
Dim blnFound
Dim rc
Dim iNoButtons
blnFound = False
' Create description of dialog object
Set objDesc = Description.Create()
objDesc("Class Name").Value = "Dialog"
objDesc("nativeclass").Value = "#32770"
' Create Description of Window
Set objWindowDesc = Description.Create
objWindowDesc("Class Name").Value = "Window"
objWindowDesc("nativeclass").Value = "Internet Explorer_TridentDlgFrame"
' Create Description of button
Set objButtonDesc = Description.Create()
objButtonDesc("Class Name").Value = "WinButton"
' See if the dialog exists
rc = Browser("creationtime:=0").Dialog(objDesc).Exist(1)
If rc = True Then
' See how many buttons on dialog
Set objButtons = Browser("creationtime:=0").Dialog(objDesc).ChildObjects(objButtonDesc)
iNoButtons = objButtons.Count
' See if we have OK or Cancel or something else
If iNoButtons > 1 Then
' Find the action button as passed in via the parameter
For i = 0 To iNoButtons -1
If strAction = "" Then
' Click on button
objButtons.Item(i).Click
Exit Sub
End If
strButtonName = objButtons.Item(i).GetROProperty("text")
If strButtonName = strAction Then
blnFound = True
' Click on button
objButtons.Item(i).Click
Exit Sub
End If
Next
' See if we found the correct button
If blnFound = False Then
Reporter.ReportEvent micWarning, "Handle Pop Up", "The button to press [" & strAction & "] was not found on the Dialog, The first button found on the Dialog was pressed, this may mean the remaining steps of the test are invalid. Please check."
Exit Sub
End If
Else
' Click on button
objButtons.Item(0).Click
End If
Else
rc = Browser("creationtime:=0").Window(objWindowDesc).Dialog(objDesc).Exist(1)
If rc = True Then
' See how many buttons on dialog
Set objButtons = Browser("creationtime:=0").Window(objWindowDesc).Dialog(objDesc).ChildObjects(objButtonDesc)
iNoButtons = objButtons.Count
' See if we have OK or Cancel or something else
If iNoButtons > 1 Then
' Find the action button as passed in via the parameter
For i = 0 To iNoButtons -1
If strAction = "" Then
' Click on button
objButtons.Item(i).Click
Exit Sub
End If
strButtonName = objButtons.Item(i).GetROProperty("text")
If strButtonName = strAction Then
blnFound = True
' Click on button
objButtons.Item(i).Click
Exit Sub
End If
Next
' See if we found the correct button
If blnFound = False Then
Reporter.ReportEvent micWarning, "Handle Pop Up", "The button to press [" & strAction & "] was not found on the Dialog, The first button found on the Dialog was pressed, this may mean the remaining steps of the test are invalid. Please check."
Exit Sub
End If
Else
' Click on button
objButtons.Item(0).Click
End If
End If
End If
End Sub
'------------------------------------------------------------------
Public Sub CheckBusyIndicator()
Dim iCounter
iCounter = 0
Do While iCounter < 10
iCounter = iCounter + 1
If Browser("creationtime:=0").Object.Busy = True Then
Wait 1
Else
Exit Do
End If
Loop
Browser("creationtime:=0").Sync
Browser("creationtime:=0").Init
iCounter = 0
Do While iCounter < 180
iCounter = iCounter + 1
Wait 1
If Not (Browser("Browser").Page("Process Work").Frame("RoomPane").Image("imgBusyIndicator").Exist(1)) Then
Exit Do
End If
Loop
If Browser("Browser").Page("Process Work").Frame("RoomPane").Image("imgBusyIndicator").Exist(1) Then
Reporter.ReportEvent micFail, "Browser Busy Timeout","Browser 'Busy' indicator has been present for more than 3 minutes. Unable to proceed due to Browser Busy issue."
Reporter.EndReporting
ExitTest
End If
End Sub
'------------------------------------------------------------------
Private Sub Class_Terminate
Environment("OR") = Nothing
End Sub
End Class
'------------------------------------------------------------------
Public Function WebObjectsInstance()
Set WebObjectsInstance = New c_WebObject
End Function
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
Class clsWebList
Private m_WebObject
Private Sub Class_Initialize
Set m_WebObject = New c_WebObject
End Sub
Private Sub Class_Terminate
Set m_WebObject = Nothing
End Sub
'---------------------------------------------------------------------------
Public Sub SelectItem(strObjName, strSelection)
Dim objfocus
Dim blnFound
Dim rd, rc
' See if the object name is really a DP description
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebList", 15) = False Then
Reporter.ReportEvent micFail, "WebList Select", "The WebList object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting
ExitTest
End If
End If
thisObj.Init
If thisObj.GetROProperty("items count") = 1 Then
thisObj.FireEvent "onclick"
Wait(1)
If thisObj.GetROProperty("items count") = 1 Then
thisObj.FireEvent "onclick"
End If
Wait(2)
End If
thisObj.Init
If Left(strSelection, 1) <> "#" Then
For i = 1 To thisObj.GetROProperty("items count")
rd = thisObj.GetItem(i)
' See if this matches our value
If Instr(1, UCase(rd), UCase(strSelection)) Then
If Len(rd) > Len(strSelection) Then
blnFound = False
Else
blnFound = True
Exit For
End If
Else
blnFound = False
End If
Next
If blnFound = True Then
On Error Resume Next
thisObj.Init
thisObj.MakeObjVisible
thisObj.Select "#" & i - 1
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
End If
thisObj.Init
oNativeReporter.Filter = 1
Else
Reporter.ReportEvent micFail, "WebList Select", "WebList [" & strObjName & "] found but selection value [" & strSelection & "] not found in list. Please check input data and application. Aborting..."
Reporter.EndReporting
ExitTest
End If
Else
On Error Resume Next
thisObj.Init
thisObj.MakeObjVisible
thisObj.Select strSelection
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
End If
thisObj.Init
oNativeReporter.Filter = 1
End If
On Error GoTo 0
End Sub
'---------------------------------------------------------------------------
Public Sub MultiSelect(strObjName, strSelection)
' See if the object name is really a DP description
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebList", 15) = False Then
Reporter.ReportEvent micFail, "WebList Select", "The WebList object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting
ExitTest
End If
End If
' See if our selection is just one item or many separated by the pipe | char
If Instr(1, strSelection, "|") Then
arrSplit = Split(strSelection, "|")
For Each Ele In arrSplit
On Error Resume Next
thisObj.MakeObjVisible
thisObj.ExtendSelect Ele
If Err.Number <> 0 Then
Reporter.ReportEvent micFail, "WebList Multi-Select", "The WebList object [" & strObjName & "] was found but the option [" & Ele & "] could not be found in the list. Aborting..."
Reporter.EndReporting
ExitTest
End If
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
End If
thisObj.Init
oNativeReporter.Filter = 1
On Error GoTo 0
Next
Else
On Error Resume Next
thisObj.MakeObjVisible
thisObj.ExtendSelect strSelection
If Err.Number <> 0 Then
Reporter.ReportEvent micFail, "WebList Multi-Select", "The WebList object [" & strObjName & "] was found but the option [" & strSelection & "] could not be found in the list. Aborting..."
Reporter.EndReporting
ExitTest
End If
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
End If
thisObj.Init
oNativeReporter.Filter = 1
On Error GoTo 0
End If
End Sub
'---------------------------------------------------------------------------
Public Sub Click(strObjName)
' See if the object name is really a DP description
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebList", 15) = False Then
Reporter.ReportEvent micFail, "WebList Select", "The WebList object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting
ExitTest
End If
End If
thisObj.MakeObjVisible
thisObj.Click
On Error Resume Next
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
End If
thisObj.Init
oNativeReporter.Filter = 1
On Error GoTo 0
End Sub
'---------------------------------------------------------------------------
Public Function GetItem(strObjName, iItem)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebList", 15) = False Then
Reporter.ReportEvent micFail, "WebList Select", "The WebList object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting
ExitTest
End If
End If
GetItem = thisObj.GetItem(iItem)
End Function
'---------------------------------------------------------------------------
Public Function GetROProperty(strObjName, strProperty)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
GetROProperty = thisObj.GetROProperty(strProperty)
Else
GetROProperty = m_WebObject.GetROProp(strObjName, "WebList", strProperty)
End If
End Function
'---------------------------------------------------------------------------
Public Function GetTOProperty(strObjName, strProperty)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
GetTOProperty = thisObj.GetTOProperty(strProperty)
Else
GetTOProperty = m_WebObject.GetTOProp(strObjName, "WebList", strProperty)
End If
End Function
'---------------------------------------------------------------------------
Public Function SetTOProperty(strObjName, strProperty, strValue)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
SetTOProperty = thisObj.SetTOProperty(strProperty, strValue)
Else
SetTOProperty = m_WebObject.SetTOProp(strObjName, "WebList", strProperty, strValue)
End If
End Function
'---------------------------------------------------------------------------
Public Function ReturnObject(strObjName)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
ReturnObject = thisObj.Object
Else
Set thisObj = m_WebObject.SetObject(strObjName, "WebList")
Set ReturnObject = thisObj.Object
End If
End Function
'---------------------------------------------------------------------------
Public Function SetObject(strObjName)
Dim myObj
If Instr(1, strObjName, ":=") Then
Set myObj = m_WebObject.DPObject(strObjName, "WebList")
Set SetObject = myObj
Else
Set SetObject = m_WebObject.SetObject(strObjName, "WebList")
End If
End Function
'---------------------------------------------------------------------------
Public Sub FireEvent(strObjName, strEvent)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
thisObj.FireEvent strEvent
m_WebObject.CheckBusyIndicator
Else
m_WebObject.FireEvent strObjName, "WebList", strEvent
End If
End Sub
'---------------------------------------------------------------------------
Public Sub Highlight(strObjName)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
thisObj.Highlight
Else
m_WebObject.HighlightObject strObjName, "WebList"
End If
End Sub
'---------------------------------------------------------------------------
Public Sub Init(strObjName)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
thisObj.Init
Else
m_WebObject.ObjectInit strObjName, "WebList"
End If
End Sub
'---------------------------------------------------------------------------
Public Function WaitProperty(strObjName, strProperty, strValue, iTimeout)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
oNativeReporter.Filter = 3
WaitProperty = thisObj.WaitProperty(strProperty, strValue, iTimeout)
oNativeReporter.Filter = 1
Else
WaitProperty = m_WebObject.ObjectWait(strObjName, "WebList", strProperty, strValue, iTimeout)
End If
End Function
'---------------------------------------------------------------------------
Public Function Exist(strObjName, iTimeout)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebList")
Exist = thisObj.Exist(iTimeout)
Else
Exist = m_WebObject.DoesObjectExist(strObjName, "WebList", iTimeout)
End If
End Function
'---------------------------------------------------------------------------
End Class
Public Function c_WebList()
Set c_WebList = New clsWebList
End Function
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
Class clsWebRadioGroup
Private m_WebObject
Private Sub Class_Initialize
Set m_WebObject = New c_WebObject
End Sub
Private Sub Class_Terminate
Set m_WebObject = Nothing
End Sub
'------------------------------------------------------------------
Public Function SelectItem(strObjName, strValue)
Dim strAll
Dim flagExist
' See if the object name is really a DP description
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebRadioGroup", 15) = False Then
Reporter.ReportEvent micFail, "WebRadioGroup SelectItem", "The WebRadioGroup object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting
ExitTest
End If
End If
strValue1 = strValue
If UCase(strValue) = "YES" Then
strValue = "true"
End If
If UCase(strValue) = "NO" Then
strValue = "false"
End If
strAll = thisObj.GetROProperty("all items")
strSplit = Split(strAll,";")
flagExist = 0
For i=0 to UBound(strSplit )
If strSplit(i) = Cstr(strValue) Or strSplit(i) = Cstr(strValue1)Then
thisObj.MakeObjVisible
thisObj.Select strSplit(i)
On Error Resume Next
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
End If
thisObj.Init
oNativeReporter.Filter = 1
On Error GoTo 0
flagExist = 1
Exit For
End If
Next
If flagExist = 0 Then
Reporter.ReportEvent micFail, "Select from "& strObjName & " Radio button group.", "The item "& strValue1 & " is not present in the Radio button group."
Reporter.EndReporting
ExitTest
End If
End Function
'------------------------------------------------------------------
Public Function Click(strObjName)
Dim strAll
Dim flagExist
' See if the object name is really a DP description
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebRadioGroup", 15) = False Then
Reporter.ReportEvent micFail, "WebRadioGroup Click", "The WebRadioGroup object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting
ExitTest
End If
End If
On Error Resume Next
thisObj.MakeObjVisible
thisObj.Click
oNativeReporter.Filter = 3
If thisObj.GetTOProperty("busyind") = 1 Then
m_WebObject.CheckBusyIndicator
m_WebObject.HandlePopUp ""
End If
oNativeReporter.Filter = 1
thisObj.Init
On Error GoTo 0
End Function
'---------------------------------------------------------------------------
Public Function GetROProperty(strObjName, strProperty)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
GetROProperty = thisObj.GetROProperty(strProperty)
Else
GetROProperty = m_WebObject.GetROProp(strObjName, "WebRadioGroup", strProperty)
End If
End Function
'---------------------------------------------------------------------------
Public Function GetTOProperty(strObjName, strProperty)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
GetTOProperty = thisObj.GetTOProperty(strProperty)
Else
GetTOProperty = m_WebObject.GetTOProp(strObjName, "WebRadioGroup", strProperty)
End If
End Function
'---------------------------------------------------------------------------
Public Function SetTOProperty(strObjName, strProperty, strValue)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
SetTOProperty = thisObj.SetTOProperty(strProperty, strValue)
Else
SetTOProperty = m_WebObject.SetTOProp(strObjName, "WebRadioGroup", strProperty, strValue)
End If
End Function
'---------------------------------------------------------------------------
Public Function ReturnObject(strObjName)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
ReturnObject = thisObj.Object
Else
Set thisObj = m_WebObject.SetObject(strObjName, "WebRadioGroup")
Set ReturnObject = thisObj.Object
End If
End Function
'---------------------------------------------------------------------------
Public Function SetObject(strObjName)
Dim myObj
If Instr(1, strObjName, ":=") Then
Set myObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
Set SetObject = myObj
Else
Set SetObject = m_WebObject.SetObject(strObjName, "WebRadioGroup")
End If
End Function
'---------------------------------------------------------------------------
Public Sub FireEvent(strObjName, strEvent)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
thisObj.FireEvent strEvent
m_WebObject.CheckBusyIndicator
Else
m_WebObject.FireEvent strObjName, "WebRadioGroup", strEvent
End If
End Sub
'---------------------------------------------------------------------------
Public Sub Highlight(strObjName)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
thisObj.Highlight
Else
m_WebObject.HighlightObject strObjName, "WebRadioGroup"
End If
End Sub
'---------------------------------------------------------------------------
Public Sub Init(strObjName)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
thisObj.Init
Else
m_WebObject.ObjectInit strObjName, "WebRadioGroup"
End If
End Sub
'---------------------------------------------------------------------------
Public Function WaitProperty(strObjName, strProperty, strValue, iTimeout)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
oNativeReporter.Filter = 3
WaitProperty = thisObj.WaitProperty(strProperty, strValue, iTimeout)
oNativeReporter.Filter = 1
Else
WaitProperty = m_WebObject.ObjectWait(strObjName, "WebRadioGroup", strProperty, strValue, iTimeout)
End If
End Function
'---------------------------------------------------------------------------
Public Function Exist(strObjName, iTimeout)
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebRadioGroup")
Exist = thisObj.Exist(iTimeout)
Else
Exist = m_WebObject.DoesObjectExist(strObjName, "WebRadioGroup", iTimeout)
End If
End Function
End Class
Public Function c_WebRadioGroup()
Set c_WebRadioGroup = New clsWebRadioGroup
End Function
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
Class clsWebButton
Private m_WebObject
Private Sub Class_Initialize
Set m_WebObject = New c_WebObject
End Sub
Private Sub Class_Terminate
Set m_WebObject = Nothing
End Sub
'---------------------------------------------------------------------------
Public Sub Click(strObjName)
' See if the object name is really a DP description
If Instr(1, strObjName, ":=") Then
Set thisObj = m_WebObject.DPObject(strObjName, "WebButton")
Else
If m_WebObject.DoesObjectExist(strObjName, "WebButton", 15) = False Then
Reporter.ReportEvent micFail, "WebButton Click", "The WebButton object [" & strObjName & "] could not be found. Aborting..."
Reporter.EndReporting