I have been searching for hours trying to find a way to capture HTML navigation response codes in Truclient, and the only posts I can find on this forum are from 2013 indicating the functionality had not been implemented at that time.
In the HTTP / HTML client I can leverage XMLHttpRequest, but that does not appear to be valid in TruClient as the below code fails with an "XMLHttpRequest is not defined" error message:
var httpOpen;
httpOpen = new XMLHttpRequest();
httpOpen.open("HEAD", myURL, false);
httpOpen.send();
//If the opened page returns a 404 error code then retrieve a new page URL value, else exit FOR Loop
if (httpOpen.status == 404) {
myURL = "http://" + LR.getParam("host") + LR.getParam("PDP_Link");
lr_output_message("Url is: %s",myURL);
} else {
pageFound = "true";
}
}
I need to be able to trap page response error codes and (in the case of a 404 or 500 return) re-try the navigate step up to 5 times. Any way to do this if the above doesn't work in TruClient?