Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. QA Tools
  3. Squish
  4. test.ocrTextPresent how to use Regular Expressions

test.ocrTextPresent how to use Regular Expressions

Scheduled Pinned Locked Moved Solved Squish
2 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danil Sh.rf
    wrote on last edited by
    #1

    I have image with more text. Part of text looks like "Hello(word), today(all) and other text". I want to search "Hello(word)" with regexp "Hello*".
    I use

    test.ocrTextPresent('Hello(word)', {1000, message}, window)

    and Squish returned boolean True
    if I sent

    test.ocrTextPresent('Hello*', {3000, message}, window)

    Squish returned boolean False, it means that could not found word in text.
    How can to set regexp for this method?
    Description:
    https://doc.qt.io/squish/squish-api.html#test-ocrtextpresent-function

    C 1 Reply Last reply
    0
    • D Danil Sh.rf

      I have image with more text. Part of text looks like "Hello(word), today(all) and other text". I want to search "Hello(word)" with regexp "Hello*".
      I use

      test.ocrTextPresent('Hello(word)', {1000, message}, window)

      and Squish returned boolean True
      if I sent

      test.ocrTextPresent('Hello*', {3000, message}, window)

      Squish returned boolean False, it means that could not found word in text.
      How can to set regexp for this method?
      Description:
      https://doc.qt.io/squish/squish-api.html#test-ocrtextpresent-function

      C Offline
      C Offline
      clanhuth
      wrote on last edited by
      #2

      @Danil-Sh-rf said in test.ocrTextPresent how to use Regular Expressions:

      Squish returned boolean False, it means that could not found word in text.
      How can to set regexp for this method?
      Description:
      https://doc.qt.io/squish/squish-api.html#test-ocrtextpresent-function

      Hi,

      This function is for verifying a single, hardcoded piece of text.

      You can implement this yourself by having it fetch all text (ideally from the smallest area/region/scope possible, for example just a single window, instead of all windows/the complete desktop), and then perform any kind of search you desired in the string returned by the OCR functionality.

      Best regards,
      Clemens Anhuth

      1 Reply Last reply
      0
      • C clanhuth has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved