cancel
Showing results for 
Search instead for 
Did you mean: 

Region.find is always returning true

SOLVED
Highlighted
New Contributor

Region.find is always returning true

I have used Regions.Find to find an image(stored in Region) in an object.

But the code is passing even when the image is not present in the object

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Re: Region.find is always returning true

Object = Aliases.VizGui.wndViz.TkChild.TkChild.TkChild.PeakOCSWnd; is an image.

ss= it is the region i have created.


Below code will help you compare the ss regions to get compare with the Object

Regions.Items(ss).Check(Object , false, false, 1, 1);

View solution in original post

8 REPLIES 8
Highlighted
Community Hero

Re: Region.find is always returning true

Hi,

 

Can you provide sample code that does not work?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
New Contributor

Re: Region.find is always returning true

This is the code snippet i am using for a POC purpose

 

function Test()
{


let page = Aliases.VizGui.wndViz.TkChild.TkChild.TkChild.PeakOCSWnd;

Regions.Find("abc",page)
Regions.FindRegion("ss",page)


}

Highlighted
Community Hero

Re: Region.find is always returning true

And what are your expectations?

What exactly does not work as you expected?

Have you read documentation for the method: https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/stores/regions/find.... ?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
New Contributor

Re: Region.find is always returning true

I want to validate that in a given object(which is an image) the stored region is present or not.

 

Object = Aliases.VizGui.wndViz.TkChild.TkChild.TkChild.PeakOCSWnd; is an image.

 

ss= it is the region i have created.

 

i want to find  "ss"(Region) in object.

Highlighted
Community Hero

Re: Region.find is always returning true

That's fine. As per documentation, the result of .Find() is either null or coordinates of the found region within the image. Your sample code just calls .Find(). That is why I wondered about your expectations from code execution and provided a link to the documentation with description and code sample.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
New Contributor

Re: Region.find is always returning true

If is it not "null " that means testComplete has find the image inside another image. While I know for the fact by seeing both the images that the result should be null.

 

that is the query i am asking, how to validate whether .Find method is able to find the region or not

Highlighted
Community Leader

Re: Region.find is always returning true

Object = Aliases.VizGui.wndViz.TkChild.TkChild.TkChild.PeakOCSWnd; is an image.

ss= it is the region i have created.


Below code will help you compare the ss regions to get compare with the Object

Regions.Items(ss).Check(Object , false, false, 1, 1);

View solution in original post

Highlighted
Community Manager

Re: Region.find is always returning true

Thank you, Community!🙂

 

@shubham1 could you give Anupam's suggestion a try to see if it works?


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors