App.close() closes Gmail instead of my app

Asked by William Handrigan on 2018-04-13

I'm using Sikuli to automate testing of my company's software. It is named something like "Company Name Software". My scripts have a setup which includes the line 'AppName=App("Company Name Software")' and then I can do things like 'if not AppName.window(): App.open("C:\Path\Company Name Software.exe")' and 'AppName.close()'

This all works fine...UNLESS I have my company Gmail open and as the current tab in chrome. For some reason, this seems to satisfy the requirements for being AppName. If I check if the software is open, with it closed but Gmail open, the script thinks it is open. If I use 'AppName.close()' it closes Chrome.

The only thing I can think of is the full name of the Gmail tab is 'Inbox - <email address hidden> - Company Name Inc. Mail' and somehow 'Company Name Inc.' is close enough to 'Company Name Software' and the script gets confused somehow.

This isn't really a blocker issue, as if I notice what's going on I just change the tab in Chrome, but it is a big annoyance.

Ideally, I'm looking for some way to permanently stop this behaviour. Perhaps somebody knows of a workaround. I'm also wondering if this is a genuine bug, or if perhaps I'm using the App functions incorrectly.

Thoughts?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-04-17
Last query:
2018-04-17
Last reply:
2018-04-17
vishal.mishra (vishal.mishra) said : #1

Hi William- Could you try by giving static path to close the application.

path="C:\\WINDOWS\\system32\\Notepad.exe"
App.open(path)
App.close(path)

Thanks- https://www.blog10.website/sikuli-tutorial-download-python-gui-automation-script/

William Handrigan (willardee) said : #2

That doesn't work. In that instance, the App.close() doesn't seem to do anything.

vishal.mishra (vishal.mishra) said : #3

AppName=App("C:\\Path\\Company Name Software.exe")
if not AppName.window():
    App.open("C:\\Path\\Company Name Software.exe")
App.close("C:\\Path\\Company Name Software.exe")

William Handrigan (willardee) said : #4

Yes, that's what I tried and the App.close(path) does nothing.

Best RaiMan (raimund-hocke) said : #5

Already tried with the latest 1.1.3 nightly?

BTW: the intended use is:
app=App("C:\\Path\\CompanyNameSoftware.exe")
if not app.window():
    app.open()
app.close()

If the path string contains blanks, it must be written so:
app=App("\"C:\\Path\\Company Name Software.exe\"")

William Handrigan (willardee) said : #6

That's got it, I wasn't using the feature quite correctly.

Much obliged!

William Handrigan (willardee) said : #7

Thanks RaiMan, that solved my question.