Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Recognize that Browser returns an Error page after hitting a URL with QTP ?
#1
Not Solved
I am stuck with one issue with my script. What I am doing is hitting a particular URL fetched from a excel sheet and then checking if this URL is returning a valid response page.
I need to report any error page returned by the browser on any URL hit (it could be 404 or 503). I am unable to get a handle of any error page i.e.
All I need is to identify that the browser has returned an error page and report it in my script, it should not matter whether it returns any error code.
Is there an element on the browser which notifies that an error page is returned which can be captured with QTP script?

Thanking in Anticipation
Reply
#2
Not Solved
You could capture the text from the page and look for the error number?
Reply
#3
Not Solved
This can be one thing but many a times the error page is formatted to show company specific error messages OR the total look and feel is changed to hold some other message maybe "Sorry, Try again Later" OR "Please try after some time" etc. How to handle such situations ?
Reply
#4
Not Solved
HI,

I would rather check for the desired page or the object in the desired page. As the error message is not specific.
Thanks,
SUpputuri
Reply
#5
Not Solved
Hi Supputuri,

The messages are just to explain the issue and not intended to be captured by QTP.

You are right but can you let me know which object on the page I can check for to know anything about the error.
Reply
#6
Not Solved
If you are sent to an error page then the actual URL will be different from the one expected, so check that. Since this is presumably not a one off test then you will know or can get the list of error urls that the test is going to navigate to as you run through. Just check the URL of the current page against the one expected or against the list of error URLs
Reply
#7
Not Solved
Hi.

It depends on how you're invoking the URL.

If you're using the "InternetExplorer.Application" approach, then your task becomes very easy. Follow the code below:

Set objIE = WScript. CreateObject("InternetExplorer.Application", "objIE_")

By using this, you've attached a name to the IE object.


Now, you invoke the URL. Also define a Sub like so:

Code:
Sub objIE_NavigateError(pDisp, URL, TargetFrameName, StatusCode, Cancel)
' in case there's been an error, for example, 404 Not Found, then the control would 'reach this place.
MsgBox. "Error: " & StatusCode
End Sub

Let me know if this helped.
Reply
#8
Not Solved
Check if you can use "broken links" option in page check point
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SendKeys changing focus to IE url when executed from framework psova 0 2,142 06-09-2015, 07:19 PM
Last Post: psova
  How to get URL/Location from Address bar of any open window in Windows 7 kalpmist 0 4,332 05-11-2015, 07:23 PM
Last Post: kalpmist
  Does QTP recognize C++ Objects? Babita01 0 3,543 05-15-2012, 03:09 PM
Last Post: Babita01
  QTP doesnot recognize Java objects. Babita01 0 3,909 05-15-2012, 11:41 AM
Last Post: Babita01
  JBoss error mask upon returning to page from a popup Anuroop 1 2,095 03-15-2012, 05:40 PM
Last Post: Anuroop

Forum Jump:


Users browsing this thread: 3 Guest(s)