selecting list item
Posted: Wed Aug 22, 2012 2:50 pm
using the following code sometime error returned NO element found for "ListItem item" , is any advice on selecting listitem w/code snippet please.
Code: Select all
public void SelectContactStatus(string _contactStatus)
{
bool found = false;
WebDocument webDocument = "/dom[@caption=xxyy']";
Ranorex.SelectTag findContactStateList;
found = webDocument.TryFindSingle(".//select[@id='cboContactStatus']", 10000, out findContactStateList);
if (!found)
{
throw new Ranorex.ElementNotFoundException("Contact State list was not found", null);
}
else
webDocument.EnsureVisible();
findContactStateList.Click(Location.CenterRight);
Delay.Ms(2000);
// find the right item in the popup and click it
ListItem item = "/container[@caption='selectbox']/listitem[@text='"+_contactStatus+"']";
item.Click();
Delay.Ms(1000);
item.PressKeys("{TAB}");
Delay.Ms(1000);
[code]
Thank you