Forum Discussion
neha_sharma
12 years agoContributor
You can also use this :
Function AddDelay(obj_type,obj_name)
Dim Pg, waitFrm, Frame, Frames
Set Pg = Aliases.IE.Page("*")
' Wait for frames
Pg.wait
Pg.Refresh
waitFrm = True
Set Frames = GetFrames(Pg) 'Obtain the frames collection
For Each Frame In Frames
If Frame.Exists Then
waitFrm= true
while waitFrm
waitFrm = waitFrm And (Frame.readyState <> "complete")
If waitFrm Then
aqUtils.Delay 100
End If
WEnd
' Else
' Log.Message("No Frame Available")
End If
Next
Set Window = Aliases.IE.Page("*")
cycle = 120
count = 0
Do While Not (window.NativeWebObject.Find(obj_type,obj_name).Exists)
Delay(1000)
count = count +1
if count = cycle Then
Log.Error("Required ' "&obj_name&" ' not found on page.Please look into the issue.")
Exit Do
End If
Loop
End Function
' Obtain the frames collection
Function GetFrames(APage)
Select Case Options.Web.TreeModel
Case "DOM" Set GetFrames = APage.document.frames ' DOM model
Case "Tag" Set GetFrames = APage.FRAME ' Tag model
Case Else Set GetFrames = APage ' Tree and Hybrid models
End Select
End Function
Function AddDelay(obj_type,obj_name)
Dim Pg, waitFrm, Frame, Frames
Set Pg = Aliases.IE.Page("*")
' Wait for frames
Pg.wait
Pg.Refresh
waitFrm = True
Set Frames = GetFrames(Pg) 'Obtain the frames collection
For Each Frame In Frames
If Frame.Exists Then
waitFrm= true
while waitFrm
waitFrm = waitFrm And (Frame.readyState <> "complete")
If waitFrm Then
aqUtils.Delay 100
End If
WEnd
' Else
' Log.Message("No Frame Available")
End If
Next
Set Window = Aliases.IE.Page("*")
cycle = 120
count = 0
Do While Not (window.NativeWebObject.Find(obj_type,obj_name).Exists)
Delay(1000)
count = count +1
if count = cycle Then
Log.Error("Required ' "&obj_name&" ' not found on page.Please look into the issue.")
Exit Do
End If
Loop
End Function
' Obtain the frames collection
Function GetFrames(APage)
Select Case Options.Web.TreeModel
Case "DOM" Set GetFrames = APage.document.frames ' DOM model
Case "Tag" Set GetFrames = APage.FRAME ' Tag model
Case Else Set GetFrames = APage ' Tree and Hybrid models
End Select
End Function