Ask a Question

Region.find is always returning true

SOLVED
shubham1
Occasional 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

8 REPLIES 8
AlexKaras
Community Hero

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
================================
shubham1
Occasional Contributor

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)


}

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
================================
shubham1
Occasional Contributor

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.

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
================================
shubham1
Occasional Contributor

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

anupamchampati
Frequent Contributor

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);

sonya_m
SmartBear Alumni (Retired)

Thank you, Community!🙂

 

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


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: