Page access denied but not everytime
Hi
I am using the following piece of code to access the dom page structure and it works most of the times but suddeny it throws an error stating that the access is denied
really not able to understand why this happens
CODE
Function GetPageObject()
Dim PageObj ': PageObj = Array()
Dim PgName
Dim pageURL : pageURL = ""
Dim Page : Set Page = NothingDim Obj : Set Obj = Nothing
Dim Counter : Counter = 5
' Verify whether an arbitrary
' or specific (with the given URL) Page object is needed
If (pageURL="")Then
pageURL="*"
Else
pageURL="*" & pageURL & "*"
End If
PgName="Page(" & pageURL & ")"
Sys.Process("iexplore", 2).Refresh
Set Page = Sys.Process("iexplore",2)
' Search for the child objects of the browser Process
PageObj = Page.FindAllChildren("Name",PgName,60)If UBound(PageObj) <> -1 Then
If IsObject(PageObj(UBound(PageObj))) ThenIf InStr(LCase(PageObj(UBound(PageObj)).URL),LCase("http://crmtest.xln/cust_acct_frame.asp")) > 0 THENaqUtils.Delay 2000
' Sys.Process("iexplore", 2).Refresh
On Error Resume Next
Counter = 5
Do
If Counter = 0 Then
Exit Do
End If
Counter = Counter - 1
Delay 500
Set Obj = PageObj(UBound(PageObj)).zDocument.frames("TOPFRAME").document
Set GetPageObject = Obj
If NOT Obj Is Nothing ThenEXIT FunctionEnd If
Loop While Obj Is Nothing
Set Obj = PageObj(UBound(PageObj)).zDocument.frames("TOPFRAME").document
Set GetPageObject = Obj
EXIT FunctionIf (Not PageObj(UBound(PageObj)).Exists) ThenLog.Error("The Page(" & pageURL & ") object was not found.")
Set GetPageObject=NothingElseSet GetPageObject=Obj
End IfElse
Set obj = PageObj(UBound(PageObj)).zDocument
If (Not PageObj(UBound(PageObj)).Exists) ThenLog.Error("The Page(" & pageURL & ") object was not found.")
Set GetPageObject=NothingElseSet GetPageObject=Obj
End IfEnd If
End If ' End of if to check that PageObject is a Object
Else
Log.Warning(" Unable to get the Page Object ") End If ' End of if to check that PageObject Exists
End Function
I have under bolded and underlined the code at which it occurs but at the same time if i F12 in IE I can see the DOM strucure in the developer tools so really can not understand why Test Complete is unable to access
Any help would be much appreciated
Regards
Anand