sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #25312
Re: [Question #247044]: how to get the last element of findAll
Question #247044 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/247044
Status: Open => Answered
RaiMan proposed the following answer:
as far as I understood your setup, the checkboxes (cbx) are arranged
this way:
(cb1) some text (cb2) some text (cb3) some text
(cb4) some text (cb5) some text
supposing, they are vertically aligned (same y value for cb4 and cb 5),
than it is not predictable, that always cb5 is sortedList[-1], it might
be sortedList[-2] (so it might depend on air pressure or something
similarly random ;-)
so you have to sort the last two values according to their x value.
or use a lambda like this:
last_element = sorted(elements, key=lambda element: element.y * 10000 + element.x)[-1]
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.