# OCR checkpoint posting warning, instead of error

**URL:** <https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408>\
**Category:** TestComplete\
**Tags:** test, testcomplete, migrated\
**Created:** [July 31, 2025, 7:26am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408 "2025-07-31T07:26:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 31, 2025, 7:26am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/1 "2025-07-31T07:26:06Z")

</div>

> Originally posted by **GiorgiNiavadze** on July 31, 2025

In order to achieve my goal that, when OCR checkpoint fails throw it warning instead of error.  
I have this function, according to your suggestion: ([CheckText Method | TestComplete Documentation](https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextdocument/checktext.html))

My function function OcrCheckpointThrowsWarning(searchAreaObject, textToCheck) {

let ApplicationProcess = Sys.WaitProcess(“LMS”, 300);  
let recognizedText  
if (ApplicationProcess.Exists)  
{  
recognizedText = OCR.Recognize(searchAreaObject);  
recognizedText.CheckText(“\*”+textToCheck+“\*”)  
Log.Message(`${textToCheck} - FOUND`);  
}else{  
Log.Warning(`${textToCheck} - NOT FOUND`);  
}  
}

searchAreaObject is onscreen object element  
textToCheck is text that I want to find

this function work for me several days but, after updating of testcomplete it does not work any more. now while error (if function do not find text I want) it throws error instead of warning.

my testcomplete current version is:15.76.5.7 x64  
what you think is it blame on version? if it, please provide another method to achieve this approach

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 31, 2025, 10:26am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/2 "2025-07-31T10:26:19Z")

</div>

> Originally posted by **rraghvani** on July 31, 2025

This is just a suggestion, as I don’t use OCR. Try using a [try…catch](https://support.smartbear.com/testcomplete/docs/scripting/handling-exceptions.html) if it throws an exception. Or adjust your project settings → playback, error handling

 ![](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/d1ab1e37be9821355a6effa0e283518bf9e6a895.png)

They may have changed the functionality of OCR, so that it errors instead or it could be an issue.

Alternatively, open a support ticket via [https://support.smartbear.com/testcomplete/message/](https://support.smartbear.com/testcomplete/message/)

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 31, 2025, 1:56pm UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/3 "2025-07-31T13:56:45Z")

</div>

> Originally posted by **GiorgiNiavadze** on July 31, 2025

rraghvani​

I have troubleshoot many ways:  
use with try/catch block for this function  
in this situation does not worked catch block, it do not runs in catch block while error

I know playback functionalities but, I do not want to use this to configure on error and on exception options to continue test, this is not only one reason cause I want to option between error and warning while using OCR.  
I want to achieve only one goal, I would can choose message type when exception happen in OCR error or warning from exactly in OCR CHECKPOINT in keyword test in checkpoints operations or suggest me some function which is like above my function and work as I explain

I have opened a support ticket also : The following unique identifier was assigned to your request: **00760175**

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 31, 2025, 2:24pm UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/4 "2025-07-31T14:24:05Z")

</div>

> Originally posted by **rraghvani** on July 31, 2025

Have you tried the following example code in [https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextdocument/checktext.html](https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextdocument/checktext.html) ?

You should check if _searchAreaObject_ exists. Avoid using wildcards within the parameter of _recognizedText.CheckText(“\*”+textToCheck+“\*”)_ and instead pass in your string containing wildcards e.g. “\*mystring\*”. If _ApplicationProcess.Exists_ returns false, your are then printing _Log.Warning(`${textToCheck} - NOT FOUND`);_, which is incorrect.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 31, 2025, 3:48pm UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/5 "2025-07-31T15:48:15Z")

</div>

> Originally posted by **Hassan\_Ballan** on July 31, 2025

Can you provide the error details you are getting? The error message can tell a lot.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 8:26am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/6 "2025-08-01T08:26:35Z")

</div>

> Originally posted by **GiorgiNiavadze** on August 01, 2025

this screenshots all about code with arguments and pass/failed results

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 8:28am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/7 "2025-08-01T08:28:54Z")

</div>

> Originally posted by **GiorgiNiavadze** on August 01, 2025

As I mentioned above, this function worked for a certain period of time in such a way that, in case of failure, it threw a warning instead of an error using the .CheckText() method. If the .CheckText() method could not find the desired text, it would throw a warning instead of an error itself.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 8:57am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/8 "2025-08-01T08:57:00Z")

</div>

> Originally posted by **rraghvani** on August 01, 2025

Your conditional if state is incorrect – you are checking the existence of your application. If the application does not exist, you output the following “_Log.Warning(`${textToCheck} - NOT FOUND`)_”.

You first need to verify that searchAreaObject exists, before passing the variable into OCR.Recognize() method

Secondly, you need to verify the returned value of recognizedText.CheckText() method.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 9:42am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/9 "2025-08-01T09:42:58Z")

</div>

> Originally posted by **GiorgiNiavadze** on August 01, 2025

because, it is not important to check existence of application but, can you provide correct working function according to my function ?

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 9:56am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/10 "2025-08-01T09:56:23Z")

</div>

> Originally posted by **rraghvani** on August 01, 2025

Line 5, indicates that you are checking the exitance of your application!

 ![](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/4884b7de9ade7fa260d4d203e8429a595ce3d50f.png)

After reading the documentation on [CheckText](https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextdocument/checktext.html) method, take note of the following

> Use the CheckText method to perform an OCR Checkpoint, that is, to verify that the text, which a UI element or an image contains and which TestComplete recognizes, matches a specified string. If the verification succeeds, the method will post a success message to the test log; otherwise, it will post a failure message.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 10:17am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/11 "2025-08-01T10:17:29Z")

</div>

> Originally posted by **GiorgiNiavadze** on August 01, 2025

function OcrCheckpointThrowsWarning(searchAreaObject, textToCheck) {

let process = Sys.WaitProcess(“LMS”, 300);

Log.Message("Passed searchAreaObject: " + searchAreaObject);  
Log.Message("Passed textToCheck: " + textToCheck);

if (process.Exists) {  
Log.Message(“LMS process exists.”);

```
if (searchAreaObject.Exists) {  
  Log.Message("Grid object exists. Performing OCR...");

  let recognizedText = OCR.Recognize(searchAreaObject);  
  Log.Message("Recognized text: " + recognizedText.Text);  
  recognizedText.CheckText("\*" + textToCheck + "\*");  
  Log.Message("Successfully checked for text: " + textToCheck);  
} else {  
  Log.Warning("The specified grid object does not exist.");  
}  

```

} else {  
Log.Warning(“LMS is not running.”);  
}  
}

now I have this function according to you suggestion. It working if I take correct argument (the value that is appears on window) but, if I take a wrong value (that is not appear on windows) recognizedText.CheckText(“\*” + textToCheck + “\*”); throws error, but I want to throw warning.

_ **please provide the function that, you think would work as my approach** _

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 10:18am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/12 "2025-08-01T10:18:58Z")

</div>

> Originally posted by **GiorgiNiavadze** on August 01, 2025

**I think that the .CheckText() method itself should be able to throw a warning if it doesn’t find a value, without using any log.warning() method.**

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 10:28am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/13 "2025-08-01T10:28:48Z")

</div>

> Originally posted by **GiorgiNiavadze** on August 01, 2025

I think you misunderstood my goal because my goal is that if OCR can’t find the desired value in a specific window, I want it to post a warning instead of a failure message. Therefore, I ask for your help in achieving this.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 11:36am UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/14 "2025-08-01T11:36:29Z")

</div>

> Originally posted by **rraghvani** on August 01, 2025

Read [https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/ocr/about.html](https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/ocr/about.html) and take note of the following -

 ![](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/8ff76d2c838c9a8281fae1e3b92c45b63e32da5e.png)

Also note,

 ![](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/c159e654e17e25c8f782c1743a8a9474e0523d60.png)

The return value is None. Therefore it’s not possible to verify the returned value.

I’m not sure if there are options in TestComplete, to override the “error”

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [August 1, 2025, 3:43pm UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/15 "2025-08-01T15:43:42Z")

</div>

> Originally posted by **Hassan\_Ballan** on August 01, 2025

Similar to TestComplete Checkpoint method, the OCR CheckText() as documented will either result to Success or Failure [https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextdocument/checktext.html](https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextdocument/checktext.html)

To achieve your goal of custom logging, maybe try out OCRTextBlock [https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextblock/index.html](https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextblock/index.html) plus custom logic. I did not validate the following example:

```auto
// Define text to find
var textToFind = "MyText";

// Capture or define your search area
var recognized = OCR.Recognize(SearchArea);

// Search the text manually using string search over recognized.FullText
if (aqString.Find(recognized.FullText, textToFind, 0, false) > -1) {
    Log.Message("found it");
} else {
    Log.Warning("did not find it");
}

```

🤖 AI-assisted response referencing [https://support.smartbear.com/testcomplete/docs/](https://support.smartbear.com/testcomplete/docs/)

💬 Found the answer helpful? Give it a Kudos by clicking **Like**!  
✅ Got your issue resolved? Click **Mark as Solution** so others can find it quickly.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 8, 2025, 8:00pm UTC](https://community.smartbear.com/t/ocr-checkpoint-posting-warning-instead-of-error/408/16 "2025-09-08T20:00:37Z")

</div>

> Originally posted by **scot1967** on September 08, 2025

GiorgiNiavadze​ Did support resolve your issue?

```auto
My function function OcrCheckpointThrowsWarning(searchAreaObject, textToCheck) {
  
  let ApplicationProcess = Sys.WaitProcess("LMS", 300);
  let recognizedText
  if (ApplicationProcess.Exists)
  {
     recognizedText = OCR.Recognize(searchAreaObject);
     recognizedText.CheckText("*"+textToCheck+"*")
      Log.Message(`${textToCheck} - FOUND`);
  }else{
    Log.Warning(`${textToCheck} - NOT FOUND`);
  }
}

```

I don’t see the text of the warning you get but In your code you will get a warning (you coded) if the application process does not exist. This does not seem right rraghvani​ spotted this.

OCR.Recognize(searchAreaObject) should produce and error if searchAreaObject does not exist.

recognizedText.CheckText(“\*”+textToCheck+“\*”) should produce an error if the specified text is not found.

So, verify and log your values before you use them with the OCR methods.

TestComplete will log the warning/error and may or may not stop the test according to how the project settings are configured.

… If you find my posts helpful drop me a like! 👍 Be sure to mark or post the solution to help others out and/or to credit the one who helped you. 😎
