Set Value - SelectedItemText not working for my drop down

Ranorex Spy, Recorder, and Studio.
acalhoun
Posts: 14
Joined: Mon Mar 04, 2013 11:09 pm

Set Value - SelectedItemText not working for my drop down

Post by acalhoun » Tue Apr 15, 2014 6:53 pm

I am running Ranorex 5.0.1 on a Win7 machine and am having problems setting the value for a Flex drop down. I am trying to use the Set Value/SelectedItemText to set the value, but nothing is happening. I used the spy to look at the drop down with my deisred item selected so I could see the value of SelectedItemText to be sure I was using the correct value. I have used this on another flex drop down before with success, so I am not sure what is different about this one. The option I am trying to select is deep in the list so I'm not able to access it by just clicking on the drop down and selecting it. Below is the code as Ranorex produced it after I added the line via the studio.

Report.Log(ReportLevel.Info, "Set Value", "Setting attribute SelectedItemText to 'PM1, BPM' on item 'CCIsites.UploadProjects.Shell.topBoxScroller.PROJECTMANAGER'.", repo.CCIsites.UploadProjects.Shell.topBoxScroller.PROJECTMANAGERInfo, new RecordItemIndex(58))
repo.CCIsites.UploadProjects.Shell.topBoxScroller.PROJECTMANAGER.Element.SetAttributeValue("SelectedItemText", "PM1, BPM")
Delay.Milliseconds(0)
Attachments
Spy.rxsnp
Ranorex Snapshot of Application
(313.64 KiB) Downloaded 117 times

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Set Value - SelectedItemText not working for my drop down

Post by mzperix » Wed Apr 16, 2014 8:12 am

Hi acalhoun,

many times setValue is not working, since it does not trigger the events it should. Either try to use mouse click, or try to find out what event should be fired and do them from code (Although I am not sure how can this be done in flex - in javascript Ranorex can trigger javascript event, so there is a possibility to hav a solution for flex elements also).

Regards,
Zoltán Major

Rakesh123
Posts: 63
Joined: Thu Oct 28, 2010 2:18 pm

Re: Set Value - SelectedItemText not working for my drop down

Post by Rakesh123 » Wed Apr 16, 2014 5:32 pm

Hi,

As you have mentioned that the item you are trying to select is present some where bottom of the drop down list.So use focus(),Select() first to select the item.Then use click() to select the item from drop down list

Thanks,
Rakesh

acalhoun
Posts: 14
Joined: Mon Mar 04, 2013 11:09 pm

Re: Set Value - SelectedItemText not working for my drop down

Post by acalhoun » Wed Apr 23, 2014 3:07 pm

Hi Rakesh,

Thanks for the suggestion, but when I try to do a Select() on the text item in the drop down it tells me the operation is not supported. For now, I have just recorded scrolling down in the list until my option is visible, although I know that will not hold up over time.

Rakesh123
Posts: 63
Joined: Thu Oct 28, 2010 2:18 pm

Re: Set Value - SelectedItemText not working for my drop down

Post by Rakesh123 » Wed May 07, 2014 5:04 pm

Hi,

Can you share your code?Then we can come with some solution

Thanks,
Rakesh

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Set Value - SelectedItemText not working for my drop down

Post by mzperix » Thu May 08, 2014 8:27 am

Hi acalhoun,

someone shared a solution about select controls. Basically the code uses the keyboard to select the element:
http://www.ranorex.com/forum/unable-to- ... t3413.html

And here are some more reading about the subject:
http://www.ranorex.com/forum/post9801.html
http://www.ranorex.com/forum/post18920.html
http://www.ranorex.com/forum/triggering ... t3206.html

The select control could be a hard nut to crack, since even the standard HTML select control is implemented differently in IE, chrome and FF. So one solution that works in FF, many times not working in IE.

Best Regards,
Zoltan