App.focus stops working in SikuliX 1.1.1

Asked by Rayhaan Ahmed on 2017-04-18

I've been trying to upgrade to 1.1.1 for some of the new functionality with the user pop-ups, however, I noticed that App.focus calls are not working as expected. Instead, logs are showing they failed. Did the implementation change with the release? I currently have it focusing onto window titles; will I have to change how I'm doing it now?

Thanks for any help!

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-04-19
Last reply:
2017-04-20
masuo (masuo-ohara) said : #1

Write your codes about the part of APP.focus (). I think that Answer is more easy to obtain.

RaiMan (raimund-hocke) said : #2

yes, the implementation was changed internally, but should work the same way (at least in most cases).

as masuo said: concrete examples would help.

Rayhaan Ahmed (rayhaan) said : #3

Here is a segment of affected code:
    def start(self):

        # open terminator
        App.open(self.terminator)
        App.focus("home@") <---- This line isn't creating issues, but I believe that is because App.open already focuses the app
        wait(1.0)

        # maximize terminal
        doubleClick("maximize.png")
        wait(2.0)

        # set cleaning plan and robot
        type("byobu kill-server" + Key.ENTER)
        type("robot -c " + self.planName + Key.ENTER)
        AutomationLog("info", "Set cleaning plan")
        wait(0.5)
        type("robot -r " + self.robot + Key.ENTER)
        AutomationLog("info", "Set robot")
        wait(0.5)
        # start gazebo sim
        type("rosrun launch simulation.sh")
        ResultsLog("Simulation start time: " + currentTime())
        AutomationLog("info", "Gazebo simulation starting...")
        type(Key.ENTER)
        wait(13.0)

        App.focus("home@") <---- This is where it is failing to focus to the terminal
        wait(0.5)

The title of the window is 'home@unnamed (localip) - byobu'

Rayhaan Ahmed (rayhaan) said : #4

Sorry for the double post, but let me know if there is more info I can provide, thanks!

RaiMan (raimund-hocke) said : #5

try without the @

Another option is to use another part of the title, which is significant (need not be from the beginning, since the given text is checke with title.contains(giventext))

Can you help with this problem?

Provide an answer of your own, or ask Rayhaan Ahmed for more information if necessary.

To post a message you must log in.