Search rectangle

Hi ,

Can anyone please let me know how to use the set search rectangle function


I have a Text called "Done" , which is displayed in two positions on my SUT screen.

The first Position of "Done" text on screen is (436,181)

The Second Position of "Done" Text on screen is (784,198)

Iam using the following line to click on the text area, by default it is clicking on the first displayed text. ie, at (436,181)

Click (Text :"Done",TextFont:"LucidaGrande", Text Size:"11",TextColor:(48,48,48),TextBackgroundColor:(218,224,228))


But my search text is a button. at (784,198)

I tried using below line of code also,


setoption SearchRectangle, ((0, 0, 784, 198))
Click (Text :"Done",TextFont:"LucidaGrande", Text Size:"11",TextColor:(48,48,48),TextBackgroundColor:(218,224,228))

even then it is clicking at (436,181).

Please find attached screenshot for reference.


Can anyone help me out how exactly i can click on a text image in the even then if its displayed multiple times on the screen.


Please let me know in case of any further information needed

Thanks In Advance.

Comments

  • JonathanOSXJonathanOSX ForumAdmin admin
    You need the search rectangle to encompass the entire region where your button is to be found, but you also need to exclude the area where the first image would be found.

    With what you have specified it's searching from the top-left corner of the screen to the midpoint of the second image appearance. Also we don't generally recommend embedding specific points (like 784,196) in the script.

    A better approach might be to figure out what on the screen would tell a user that they are to click on the second "Done". Perhaps it's "Find a User" Icon or other label that you should search for and then use that to set the search rectangle. There is an example script (in the examples forum) that lets you specify searching Below or above another image.

    Another approach you could use is find everyImageLocation() and then just click on the second item.
    click second item of everyImageLocation(Text:"Done"...)
    
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Also keep in mind that in some cases it may be simpler to just capture an image that is unique. In your case, if you were to capture an image of the Done button (even just the interior of the button as we usually recommend) rather than using a generated text image, you could capture enough blank space along with the button label that it wouldn't match the earlier occurrence of "Done".

    There may be reasons why you prefer to use a generated text image (such as being able to localize the script for different languages). But if not, then simply capturing an image may be easier.
Sign In or Register to comment.