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

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
mrusso
Posts: 16
Joined: Thu Feb 03, 2011 12:54 am

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

Post by mrusso » Tue Aug 02, 2011 12:38 am

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?
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Tue Aug 02, 2011 10:37 am

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

mrusso
Posts: 16
Joined: Thu Feb 03, 2011 12:54 am

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

Post by mrusso » Tue Aug 02, 2011 4:43 pm

Thanks for the info, that method works great!

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