← Back to team overview

sikuli-driver team mailing list archive

[Bug 1811361] Re: [1.1.4] Windows: app focus and close does not work anymore (since 1st Jan '19)

 

I found more evidence that the issue is related to Portable version of
chrome. This is another test I runned:

This time, I first opened an instance of chrome and then tried to open
another one (both portable version and located in two different and
separate folders):

as you can see, Sikuli will not open chrome12 since it thinks it is
already opened! However the one is opened is actually Chrome1. They are
in different folders and both portable.

code:

temp = r"C:\Users\Test\Desktop\Chromes\f12\f12.exe" # another chrome already opened
App.logOn()
a = App(temp)
print a
a.open(10) #works
print "after open"
App.open("notepad") # to steel focus # worked fine.
wait(3)
a.focus() # did not work
print "after focus"
wait(3)
a.closeByKey(3) # see comment
print "after close"
App.logOff()

Log:


[AppLog] App.create: [-1:f12]
[-1:f12 ()] C:\Users\Test\Desktop\Chromes\f12\f12.exe 

[AppLog] App.open: already running: [20776:f12 (OleMainThreadWndName)] C:\Users\Test\Desktop\Chromes\f12\f12.exe 
[AppLog] App.focus: no window for [20776:f12 (OleMainThreadWndName)] C:\Users\Test\Desktop\Chromes\f12\f12.exe 
after open
[AppLog] App.create: [-1:notepad]

[AppLog] App.open: [16404:notepad (Untitled - Notepad)] notepad

[AppLog] App.focus: [16404:notepad (Untitled - Notepad)] notepad

[AppLog] App.focus: no window for [20776:f12 (OleMainThreadWndName)] C:\Users\Test\Desktop\Chromes\f12\f12.exe 
after focus

[AppLog] App.focus: no window for [20776:f12 (OleMainThreadWndName)]
C:\Users\Test\Desktop\Chromes\f12\f12.exe

[error] script [ Untitled ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\Users\Test\AppData\Local\Temp\Sikulix_1621692664\sikuli-2032410969421491184.py", line 12, in <module> a.closeByKey(3) # see comment at org.sikuli.script.App.closeByKey(App.java:638)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.NullPointerException: java.lang.NullPointerException

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1811361

Title:
  [1.1.4] Windows: app focus and close does not work anymore (since 1st
  Jan '19)

Status in Sikuli:
  Opinion

Bug description:
  1.1.4-SNAPSHOT-2019-01-10_09:21/Windows10.0/Java8(64)1.8.0_191-b12

  Windows 10 64bit

  I used this script to open two portable chrome instances and then
  tried to change the focus to them or close them with .focus() and
  .close() method but nothing happens:

  open_instances = {} # a dictionary to keep record of opened browsers
  {name:app}

  def browser(target, action = True ):
      temp = r"C:\Users\Test\Desktop\Chromes\f" + str(target) + r"\f" + str(target) + r".exe"
      if action: #for opening
          open_instances["f"+str(target)] = App(temp)
          open_instances["f"+str(target)].open(10)
      else: # for closing
          open_instances["f"+str(target)].close()
          del open_instances["f"+str(target)]
          wait(1)        
          
  def main():        
      for i in range(1,3): # trying to open the instances which works fine
          browser(i)
          wait(2)
      for i in range(1,3): # trying to close same instances but it does not work. I even tried the .focus() but no success either
          browser(i, False)

  main()

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1811361/+subscriptions


References