← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #253311]: Select last item in a drop down box

 

Question #253311 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/253311

    Status: Open => Answered

Eugene S proposed the following answer:
Hi,

I see 2 possible cases here:
1. The number of menu items is constant
2. The number of menu items is changing

So for the first case you have the following options:
1. "Click your way to the last element"

Click on the drop down menu to expand it and, assuming that the first
menu item will be highlighted, just use "type(Key.DOWN)" for a number of
times that will take you to the last item. Then hit Enter to accept the
item.

2. Offset
You can select an object on the screen and use it as a pivot to offset your mouse clicks to select the last item in the menu.


For the second case(when the number of menu items is changing) it's a bit more tricky.
The only way I can think about is just clicking "Down" button enough times to reach the last item for sure. Or, if when you reach the last item and continue going down the selection moves back up, you can try to click "Up" once when the first item in the menu is highlighted and it will skip to the last item. But that really depends on your menu behavior.


Cheers,
Eugene

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.