Region.find is always returning true
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you provide sample code that does not work?
/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
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.... ?
/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
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
/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
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Community!🙂
@shubham1 could you give Anupam's suggestion a try to see if it works?
Sonya Mihaljova
Community and Education Specialist
