rainmanwy / robotframework-SikuliLibrary

Sikuli Robot Framework Library provide keywords for Robot Framework to test UI through Sikuli.
Apache License 2.0
144 stars 61 forks source link

Inside for loop, trying to get text from a region #181

Closed yash-biswakarma closed 1 year ago

yash-biswakarma commented 1 year ago

Hello, I am a beginner to sikulixide. I have been trying to implement a program where i have to extract text which will appear on a specific region on the screen. I am using Jython with SikuliXIDE to perform my problem. I have to use for loop to achieve this. First, I have tried using find().text(). It was working fine and I can extract text from the pattern/images. But when I tried it under the loop, the function find().text() is raising an exception FindFailed, which is ok as I am finding the same image for different results(which will not be the same for different results). Now after studying the docs, the problem was using pattern, we only find the pattern on the screen based on similarity . But now I am trying with a particular region on the screen , for ex- Region(846,108,229,22). Please help, for this region on the screen, how can I extract text ( which will be dynamic for different values ) presented inside the region while running for loop.

Any type of links or approach would be helpful. Thank You

edsonharantes commented 1 year ago

Hello there, how are you?

Did you try using the keyword Read Text From Region ?

yash-biswakarma commented 1 year ago

@edsonharantes Read Text From Region is a keyword for RobotFramework, whereas I am using sikulixide to perform automation. I guess, above keyword wont be applied to sikulixide.

yash-biswakarma commented 1 year ago

Can extract the text from region using - name = Region().text() returns the text contained in the region We can also use collectXXX() and then match using the text().