Search code examples
squish

How are multiple matches handled for waitForObject?


I didn't find any statement in the Squish documentation about this: How is it handled in waitForObject (and other functions) if there are multiple matches for a given pattern?

Is the first entry returned or does this result in a LookupError?


Solution

  • The waitForObject function will return the first object matching the pattern. But this will only be a problem if the pattern is underspecified. To select a particular object from a sequence of identical objects the occurrence property can be used.

    The Object Picker and script recorder will calculate the right occurrence property automatically by the way.

    The tool's Knowledge Base has some more background information.