Combo boxes in IE6 : Automation API

Combo boxes in IE6

Class library usage, coding and language questions.

Combo boxes in IE6

Postby anzacthecat » Tue Mar 15, 2011 3: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();
}
anzacthecat
 
Posts: 29
Joined: Mon Jan 10, 2011 2:05 pm

Re: Combo boxes in IE6

Postby Support Team » Tue Mar 15, 2011 4: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
User avatar
Support Team
Site Admin
 
Posts: 4838
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Combo boxes in IE6

Postby anzacthecat » Wed Mar 16, 2011 12:13 pm

Thanks for this - problem solved.
anzacthecat
 
Posts: 29
Joined: Mon Jan 10, 2011 2:05 pm


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests