Forum Discussion

Don's avatar
Don
Contributor
9 years ago

Getting Combo Box Item stored as a String

Hello Community.

 

I am working on a Silver light application using test complete to automate the tests. I am trying to grab the string item from a combo box and am using the following code to do so:

if(element.Exists && element.Visible){
  var dropdown = element.Find("Name","SlObject('ComboBox','',1)");
  dropdown.Keys(method);  
  var cItem = dropdown.wText();
  Log.Message(cItem);

The issue that I am having is that the string does not get picked up and it does not log it. All I get is a blank Log. Does anyone have any experience or the know how so that I can grab the string from the ComboBox Dropdown.

 

Thanks 

  • Are you existing the combo box before you try and extract the current text?

     

    Many of them don't actually update the wText property until you exit the field. (Either click out, <ENTER> or <TAB>)

  • Are you existing the combo box before you try and extract the current text?

     

    Many of them don't actually update the wText property until you exit the field. (Either click out, <ENTER> or <TAB>)