[2.0.5] click text in region does not work --- workaround

Asked by TestMechanic on 2021-03-16

confirmed bug -------------------------------------- workaround

click(reg.findText(someText))

seems to work.

---------------------------------------------- will be fixed in 2.0.6

Code:

reg = <some_region>
reg.click('text_in_region') # does not click on text

see video https://www.screencast.com/t/yIdZvomTCvpz

----
Seems like click is executed on relative coordinates against Screen not against region
This seems like a bug
Note that "reg.click(image_in_region.png) works s expected

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
2021-03-19
Last reply:
2021-03-19
Chetan (cshamdas) said : #1

can you try below
control=findText("txt to search")
click(control)

TestMechanic (ndinev) said : #2

Your solution does not include use of region

I found this workaround

reg.waitText(text).click()

Chetan (cshamdas) said : #3

for region we can create a regsion and then you
region= new region()...# define it
then control = region.findText()
click(control)

RaiMan (raimund-hocke) said : #4

Both are functional equivalent:
- have some region
- wait for some text to appear or find it in that region
- click the match

@TestMechanic
yours is the one-liner shortcut

@Chetan
Yours has the advantage, that you can use the match later via control, instead of the need to write later
control = reg.getLastmatch()

RaiMan (raimund-hocke) said : #5

so happy to be solved

TestMechanic (ndinev) said : #6

@RaiMan just wondering for the original question - why reg.click does not work - is this a bug?

RaiMan (raimund-hocke) said : #7

@ndinev
Sorry, missed that. Seems you are using 2.0.4
this is indeed a bug, fixed in 2.0.5: https://github.com/RaiMan/SikuliX1/issues/338

TestMechanic (ndinev) said : #8

I am using 2.0.5
See the link in the original message. You can see the title of the IDE

RaiMan (raimund-hocke) said : #9

Thanks for feedback.

checked, confirmed --- is now a bug.