Forum Discussion
AlexeyK
Alumni
15 years agoKavitha,
I don't think that it's possible to get the response code for individual HTTP requests in functional web tests, for , as far as I know, browsers don't provide information on this.
In your case, you can determine whether or not a page has been loaded to IFRAME by analyzing the page's contents.
If you try to load a non-existing page (like http://mmm..nn.sss), the browser will display a notification that the page could not be found (see attached image1). This notification is an html page. TestComplete has access to it and its contents (see image2). So, you can
check the page's contents and decide if the page was loaded successfully.
Below, is a code snippet that demonstrates how you can do this:
Sub FrameTest
' Get the page and frame
Set page = Sys.Process("iexplore", 2).Page("file:///C:/TEMP/myPage.htm")
Set frame = page.Frame("myIFRAME")
' Get acces to the frame's document
' In TestComplete, you can do this though some child object of the frame
Set temp = frame.Child(0)
Set frameDoc = temp.document
' Get the title element that contains the error text --
' "Internet Explorer cannot display the web page"
Set titleElem = frameDoc.all("mainTitle")
' Check the element's contents
If Not (titleElem Is Nothing) Then
If titleElem.innerText = "Internet Explorer cannot display the web page" Then
Log.Error "Error loading a page."
Exit Sub
End If
End If
...
End Sub