Re: [Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
Question #184407 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/184407 RaiMan posted a new comment: @rathisoft - please do not ask questions for new topics as comments in old questions. os.walk is only available in Python 3+ SikuliX is language level 2.7, where you have only os.path.walk -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
Question #184407 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/184407 Bharathi A posted a new comment: In my case - I need to find the path of firefox first. For eg: In one PC - firefox.exe is located under program files and in another pc firefox.exe is located under appdata folder. I tried something like this but found to be not working: import os for r,d,f in os.walk("c:\\"): for files in f: if files == "firefox.exe": print os.path.join(r,files) else: print ("Not found") exit(1) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
Question #184407 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/184407 Status: Answered = Solved Jason Smith confirmed that the question is solved: Got my code working experimenting with your snippet above against mine. The underlying problem I might have been hitting was that when I was looking for a particular image on screen that I pointed to something that was not the application, and focused in on that. Thanks for the help. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
Question #184407 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/184407 Status: Open = Answered RaiMan proposed the following answer: Handling of Firefox sessions (or other modern singleProcess/multiWindow applications) on Windows is a bit tricky. You approach especially when rerun in the IDE does not work generally. The current implementation of the App class in Windows is not able to handle Firefox as expected. Try this instead, which works for me (Win 7 32Bit): ff = rC:\Program Files\Mozilla Firefox\firefox.exe ffA = App(Mozilla Firefox) if not ffA.window(): App.open(ff) for i in range(10): if ffA.window(): break wait(1) ffA.focus() App.focusedWindow().highlight(2) # only to check If at least one FF window is already open, the frontmost one is focused. If not, we open FF and wait for a window (FF has many windows open for performance reasons, but most of them are invisible normally) and finally focus. As you can see, only the approach, using the window title to identify the app, works. If you have more than one FF window open, you have to use a more specific part of the window title. Just to get an impression, run this snippet 2 or 3 times in the IDE: ff = rC:\Program Files\Mozilla Firefox\firefox.exe # opens a new ff window ffA = App.open(ff) wait(3) for i in range(100): w = ffA.window(i) if not w: break print w and look at the list of windows ;-) -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
Question #184407 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/184407 Status: Answered = Open Jason Smith is still having a problem: Executing the first code snippet results in the following error: [error] Stopped [error] An error occurs at line 9 [error] Error message: Traceback (most recent call last): File C:\Users\jsmith\AppData\Local\Temp\sikuli-tmp3389009394525568436.py, line 9, in App.focusedWindow().highlight(2) # only to check AttributeError: 'NoneType' object has no attribute 'highlight' Also, executing that focus operation still appears to put the Firefox window out of focus. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
Question #184407 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/184407 Jason Smith gave more information on the question: Just tested this on a Windows 7 32-bit OS. Didn't get the error trace above, but the focus operation still appears to put Firefox out of focus (watch the top portion of the window during the test case...it unhighlights when focus is called on the Firefox app). Could this be a problem in Firefox specifically (in that focus is implemented incorrectly)? Or is this a general Windows problem? -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #184407]: Focus function call on Firefox app causes focus to be lost on app
New question #184407 on Sikuli: https://answers.launchpad.net/sikuli/+question/184407 OS: Windows 7 64-bit Code snippet: location = C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe firefox = App.open(location) wait(5) firefox.focus() wait(5) Expected: Firefox should be in focus. Actual: On App.Open, Firefox is in focus. But when firefox.focus() is called, Firefox is taken out of focus. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp