This is worth a try. I have never used the TestComplete OCR features but you can make API calls in code to attempt to verify an API state/connection and do other testing.
I would think this would be a flakey network connection or maybe a license issue as rraghvani suggested. Firewall issues are usually consistent failures and less likely. It will either fail all the time or work.
Here is some JavaScript that may help. I just took some code I had and inserted the SmartBear OCR api path. This should return a failure code in a parsed JSON object. It will likely fail because you are not passing credentials (use resource Query?) to the API but you may be able to determine things about the api and the connection based on the response.
function sendGetRequest()
{
let resourcePath = https://ocr.api.dev.smartbear.com";
let resourceQuery = "?someparametrer=1234"; // If needed?
let url = resourcePath + resourceQuery;
try
{
// Send GET request
let response = aqHttp.CreateRequest("GET", url, false).Send();
// Check for successful response
if (response.StatusCode === 200)
{
// Parse JSON response
let allData = JSON.parse(response.Text);
Log.Message("Total records received: " + allData.length);
// Process each record
allData.forEach((record, index) => {
Log.Message("Record " + (index + 1) + ": " + JSON.stringify(record));
});
}
else
{
Log.Error("Failed to fetch data. Status code: " + response.StatusCode);
}
}
catch (error)
{
Log.Error("Error during request or data processing: " + error.message);
}
}