selecting list item

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

selecting list item

Post by omayer » 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
Tipu

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: selecting list item

Post by Ciege » Wed Aug 22, 2012 5:01 pm

Ummmm....

Is that the only error you receive?
Can you give the full error text (actual text, not your interpretation of it)?
Does the listitem actually exist?
Does it always fail on the same item?
Is the listitem visible or is it off screen?
Anything else you can provide? Without more information everything is kind of a shot in the dark...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: selecting list item

Post by omayer » Wed Aug 22, 2012 5:32 pm

Thank you Ciege to look into it, was environment issue, currently working as expected
Tipu