Combo boxes in IE6

Class library usage, coding and language questions.
anzacthecat
Posts: 31
Joined: Mon Jan 10, 2011 1:05 pm

Combo boxes in IE6

Post by anzacthecat » Tue Mar 15, 2011 2:56 pm

I have been using Ranorex to test on IE7 and 8 and have had no problem selecting items from combo boxes. However I am now using the same code to look at IE6 and it won't work:

selectItem(SelectTag selectName, string itemToSelect)
{
selectName.Focus();
selectName.Click();
ListItem listItem = "/container[@caption='selectbox']/listitem[@text='" + itemToSelect + "']";
listItem.Select();
listItem.Click();
}

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Combo boxes in IE6

Post by Support Team » Tue Mar 15, 2011 3:45 pm

Hi,

in IE6 the structure of the selectbox differs to the one of IE7 and IE8.
So in IE6 the structure looks like: Container->List->ListItem
And in IE7/8 it looks like: Container->ListItem

To make your code work for both IE6 and IE7/8 you have to change your path to following:
ListItem listItem = "/container[@caption='selectbox']//listitem[@text='" + itemToSelect + "']";

Kind regards,
Tobias
Support Team
.
Image

anzacthecat
Posts: 31
Joined: Mon Jan 10, 2011 1:05 pm

Re: Combo boxes in IE6

Post by anzacthecat » Wed Mar 16, 2011 11:13 am

Thanks for this - problem solved.