looks like an extra Click being added by IDE during loop --- definitely no

Bug #1856450 reported by Mark McGuinn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Invalid
Undecided
Unassigned

Bug Description

Hi,
the following script is designed to loop through a menu item until it fins the one it is looking for and when it does it stops the loop and is supposed to click a confirm button which takes the screen to another page. However what is happening is that the IDE finds the correct option but adds another click which takes the menu on to the next option before it clicks confirm which means it is confirming the wrong item. In the log file the extra click does not seems to be recorded but it does happen. Below is the code snippet and the logfile with debug(3) set. As far as I can tell the code logic is sound but if there is a problem with it which is causing the extra click please point it out. The code is looking for "BMW 2002 TURBO" but it is find that and then clicking on:

try:
    while found == 0:
              print("About to click")
              click("1576020708907.png")
              print("clicking")
              current_model = model_region.text()
              wait(1)

              if current_model == find_model:
                    print("Found It")
                    found = 1
                    print ("Found is = ",found)
                    click("1576403393174.png")
                    break
                    # wait(5)

              elif current_model == "ANY":
                    print("Did Not Find -->",find_model)
                    break
except:
   print("Caught exception ")

The debug output is:
.... more ...
[debug] highlight R[1157,402 233x37]@S(0) for 2.0 secs
('M is -->', 'BMW |')
('Storecar is -->', 'BMW')
exact match
[debug] DOUBLE CLICK on L[1273,420]@S(0) (558 msec)
[debug] Image: reused: 1576019906865.png (file:C:\Users\mmcguinn\Documents\Mensel.sikuli\1576019906865.png)
[debug] Region: wait: waiting 3.0 secs for 1576019906865.png to appear in R[0,0 1680x1050]@S(0)
....
[debug] Region: wait: 1576019906865.png appeared (M[788,457 56x32]@S(0) S:0.99 C:816,473 [510 msec])
[debug] CLICK on L[816,473]@S(0) (523 msec)
[debug] Finder2: makeMat: INT_RGB (223x36)
[debug] Image: reused: 1576020708907.png (file:C:\Users\mmcguinn\Documents\Mensel.sikuli\1576020708907.png)
[debug] Region: wait: waiting 3.0 secs for 1576020708907.png to appear in R[0,0 1680x1050]@S(0)
About to click
....
[debug] Region: wait: 1576020708907.png appeared (M[789,451 44x43]@S(0) S:0.93 C:811,472 [167 msec])
clicking
[debug] CLICK on L[811,472]@S(0) (527 msec)
[debug] Finder2: makeMat: INT_RGB (223x36)
('Did Not Find -->', 'BMW 2002 TURBO')

The IDE version is 2.0.1 running on Windows 10 64 bit Version 10.0.18362 Build 18362

RaiMan (raimund-hocke)
description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote :

It looks like you are moving some menu by
print("About to click")
click("1576020708907.png")
print("clicking")

under a constant region
model_region

might be, that the
model_region.text()

comes too fast.

try so:
click("1576020708907.png")
wait(1)
current_model = model_region.text()

description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote :

BTW: SikuliX does not do any extra clicks - every click action is reported!

summary: - Extra Click being added by IDE during loop
+ looks like an extra Click being added by IDE during loop
summary: - looks like an extra Click being added by IDE during loop
+ looks like an extra Click being added by IDE during loop --- definitely
+ no
Revision history for this message
Mark McGuinn (mmcguinn) wrote :

Adding in the wait solved the problem.

Revision history for this message
Mark McGuinn (mmcguinn) wrote :

Unfortunately the wait sis not solve the issue, and with the debug set to level 3 it is not recording the extra activity after the item is found. The debug shows the script finding the item, and then it logs the click at a specified location, it does not however log the click which takes the item back to ANY and thus the wrong results are returned from the script. I can provide a recording showing the behaviour along with the debug log.

Revision history for this message
RaiMan (raimund-hocke) wrote :

a recording does not help, to track down the reason.

You have to isolate the offending part of the script into an extra script without any loops and then try to find the reason by getting nearer step by step.

You might also try another approach, to move through the menu.

Be aware: right click on the column number in the IDE allows to run only parts of a script.

Revision history for this message
Mark McGuinn (mmcguinn) wrote : Re: [Bug 1856450] Re: looks like an extra Click being added by IDE during loop --- definitely no
Download full text (4.0 KiB)

Hello again,

   I have coded in another click to counteract the one added by the IDE, this takes the menu back to the correct item. This is enough to allow me to continue but I cannot understand why the extra click is added and why it is not logged by the debugging system. I don't know if you want to look at this any further, thanks for your help

Mark

The Future Is Certain Give Us Time To Work It Out
________________________________
From: <email address hidden> <email address hidden> on behalf of RaiMan <email address hidden>
Sent: Friday 27 December 2019 16:43
To: <email address hidden> <email address hidden>
Subject: [Bug 1856450] Re: looks like an extra Click being added by IDE during loop --- definitely no

a recording does not help, to track down the reason.

You have to isolate the offending part of the script into an extra
script without any loops and then try to find the reason by getting
nearer step by step.

You might also try another approach, to move through the menu.

Be aware: right click on the column number in the IDE allows to run only
parts of a script.

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1856450

Title:
  looks like an extra Click being added by IDE during loop ---
  definitely no

Status in Sikuli:
  New

Bug description:
  Hi,
  the following script is designed to loop through a menu item until it fins the one it is looking for and when it does it stops the loop and is supposed to click a confirm button which takes the screen to another page. However what is happening is that the IDE finds the correct option but adds another click which takes the menu on to the next option before it clicks confirm which means it is confirming the wrong item. In the log file the extra click does not seems to be recorded but it does happen. Below is the code snippet and the logfile with debug(3) set. As far as I can tell the code logic is sound but if there is a problem with it which is causing the extra click please point it out. The code is looking for "BMW 2002 TURBO" but it is find that and then clicking on:

  try:
      while found == 0:
                print("About to click")
                click("1576020708907.png")
                print("clicking")
                current_model = model_region.text()
                wait(1)

                if current_model == find_model:
                      print("Found It")
                      found = 1
                      print ("Found is = ",found)
                      click("1576403393174.png")
                      break
                      # wait(5)

                elif current_model == "ANY":
                      print("Did Not Find -->",find_model)
                      break
  except:
     print("Caught exception ")

  The debug output is:
  .... more ...
  [debug] highlight R[1157,402 233x37]@S(0) for 2.0 secs
  ('M is -->', 'BMW |')
  ('Storecar is -->', 'BMW')
  exact match
  [debug] DOUBLE CLICK on L[1273,420]@S(0) (558 msec)
  [debug] Image: reused: 1576019906865.png (file:C:\Users\mmcguinn\Documents\Mensel.sikuli\1576019906865.png)
  [debug] Region: wait: waiting 3.0 secs for 1576019906865.png t...

Read more...

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.