myapp.close() does not work

Asked by Hitesh Shah

I have opened firefox with the following command:
fire = App.open(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")

Trying to close it using:
fire.close()

or even

App.close(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")

dose not close the App. The Firefox window is still remains open.

Do we need to clean up manually or is there a different way to close the firefox window?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene Maslov
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

On Windows, the App features (except open) work best with some part of the respective app's window title.

Revision history for this message
Best Eugene Maslov (emaslov1) said :
#2

To make sure that the application is killed, Windows taskkill is possible:

os.system("taskkill /f /im firefox.exe")

Revision history for this message
Hitesh Shah (hitesh-shah) said :
#3

Problem Solved! I would have personally have preferred for this to be fixed within Sikuli though.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

@Hitesh

App.close("Mozilla Firefox")

works as mentioned in comment #1

I would personally have preferred, that before complaining about not-working, you would have tried the usage as suggested in the docs and in the comment #1.

Revision history for this message
Hitesh Shah (hitesh-shah) said :
#5

I am sorry if I came across as complaining. Who am I to complain. I can only make a request.

What I meant was to request to make

fire = App.open(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")

Trying to close it using:

fire.close()

work or

App.close(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")

work because all windows do not have a Title Bar. I was using firefox
as an example.

> To: <email address hidden>
> From: <email address hidden>
> Subject: Re: [Question #264648]: myapp.close() does not work
> Date: Tue, 7 Apr 2015 06:42:00 +0000
>
> Your question #264648 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/264648
>
> RaiMan posted a new comment:
> @Hitesh
>
> App.close("Mozilla Firefox")
>
> works as mentioned in comment #1
>
> I would personally have preferred, that before complaining about not-
> working, you would have tried the usage as suggested in the docs and in
> the comment #1.
>
> --
> You received this question notification because you asked the question.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

All application windows have a title but some are not visible as a title bar or not always visible, depending on the window layout.

I will try to make the App class more useable and consistent in version 2.

Currently in doubt one can use
tasklist /v

to see useable window titles, that can be used with App class features.