← Back to team overview

sikuli-driver team mailing list archive

[Bug 1457905] Re: [1.0.1] click() returns 1 if called with None

 

The return value of click (and similar functions) does not tell much.
Only if it is not possible to activate the Java Robot, they return 0 (meaning not possible at all).
in all other cases the return value is 1, meaning that Java Robot was advised to do a mouse or keyboard action.
A click(null) clicks at the current position of the mouse.

Only in version 2 it will be possible, to check, wether the click
happened.

You should not use the return value of click in versions up to 1.1.x.

In version 2 the return of all these functions will be either null/None,
if the function did not work and the Location of the action on success.

That you can say at all
click(region_or_location)

which implies the possibility of null/None values, is due to this
convenience feature in scripts, that allow to use non-dotted methods
like some commands (behind the scene these are mapped to be used as
SCREEN.function(), where SCREEN is a preset object as Screen(0)).

So if you want to do validations, you should validate the
"region_or_location" before using click or generally switch to use
dotted versions.

instead of
click(someRegion)

use 
someRegion.click()

and take care before, that someRegion is valid


** Changed in: sikuli
       Status: New => In Progress

** Changed in: sikuli
   Importance: Undecided => High

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => 2.0.0

** Summary changed:

- [1.0.1] click() returns 1 if called with None 
+ [1.0.1] click() returns 1 if called with None --- is as it is up to 1.1.x

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

Title:
  [1.0.1] click() returns 1 if called with None --- is as it is up to
  1.1.x

Status in Sikuli:
  In Progress

Bug description:
  Sikuli 1.0.1, Win 7 64
  I wanted to do some fail state checking by catching return of click function and was very surprised that click returns 1 even if it is 
  passed invalid object. is it intended?

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


References