Page 1 of 1

Selecting Option element within a SelectTag ListBox (size>1)

Posted: Tue Aug 02, 2011 12:38 am
by mrusso
I've seen the forum post for dropdown boxes How to select a Option in a Select tag element (Dropdown), but that method isn't working for a standard SelectTag with size > 1 (a listbox as opposed to a dropdown).

Namely, I can click on options within this SelectTag, but only if they are displayed on screen. EnsureVisible() doesn't seem to scroll to these options properly. IF the option is visible, it is properly clicked.

Any suggestions?

Re: Selecting Option element within a SelectTag ListBox (size>1)

Posted: Tue Aug 02, 2011 10:37 am
by Support Team
Hi,

Sorry but EnsureVisible() or Focus() method won't work in both Browsers (IE and Firefox), because these browsers don't provide us such a functionality. Maybe we can handle it with java-script or such a workaround in our code. Meanwhile I would suggest you to use the selected property for the OptionTag Element. This ensures that the item is visible in your listbox.
For example:
OptionTag optionTagTest = "OptionTagPath";
optionTagTest .Selected = true;
Regards,
Peter
Ranorex Team

Re: Selecting Option element within a SelectTag ListBox (size>1)

Posted: Tue Aug 02, 2011 4:43 pm
by mrusso
Thanks for the info, that method works great!

It seems to work for the traditional size=1 SelectTag (dropdown) and size > 1 (listbox) elements.