Forum Discussion

nisgupta's avatar
nisgupta
Valued Contributor
3 years ago
Solved

We Application Error -HTTP Status 404 Not Found - Not able to catch this error

We do have error appear for our web applications due to - database down, server down, image get broken. We verify the error in browser title. Recently we saw anoher error - HTTP Status 404 - Not Found, But we are not able to catch this one.

 

We are using the following code 

 

var error_http_status_404 = "HTTP Status 404 - Not Found";

 

var comparehttp_status_404 = aqString.Compare(error_http_status_404, actualBrowsertitle, false);
Log.Message("http status 404 error" +comparehttp_status_404);

if(comparehttp_status_404 == 0){
app_error_appear = 1;
}

 

It do not work for this above error , We do have other error appear like server not found in browser title , we are applying the same logic as above and it works.

Attching the MHT Report that shows HTTP Status 404 Not Found . Let me know what we are mising ?

 

Thanks

NG

 

 

  • Hello,

     

    I suppose the strings that you compare have some insignificant differences. This could be a different "-" sign, or extra space in the end, for example. 

     

    Please get the actualBrowsertitle variable value and copy it to Notepad, then press Enter and paste the value that you store in the string variable as a second row. 

    var error_http_status_404 = "HTTP Status 404 - Not Found"

     

    Try comparing them in Notepad (e.g. use search to find a string, you should get two results by one search). Pay attention to the spaces at the end of the string, one of them could contain them, another one doesn't not. 

2 Replies

  • YuriPeshekhonov's avatar
    YuriPeshekhonov
    SmartBear Alumni (Retired)

    Hello,

     

    I suppose the strings that you compare have some insignificant differences. This could be a different "-" sign, or extra space in the end, for example. 

     

    Please get the actualBrowsertitle variable value and copy it to Notepad, then press Enter and paste the value that you store in the string variable as a second row. 

    var error_http_status_404 = "HTTP Status 404 - Not Found"

     

    Try comparing them in Notepad (e.g. use search to find a string, you should get two results by one search). Pay attention to the spaces at the end of the string, one of them could contain them, another one doesn't not.