Forum Discussion

robertsg32's avatar
robertsg32
Occasional Contributor
14 years ago

combo box item not found

I have a dynamically created dropdown with years populated in it from 2012 to 1900.  I select a year during the recording and when I run my test it keeps erroring saying "The combo box item 1962 not found".


8 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Are you wrapping the year in a string delimiter?



    SelectItem("1962")
  • robertsg32's avatar
    robertsg32
    Occasional Contributor
    Thanks for the quick response Robert!



    I am new to Test Complete so bare with me.



    The dropdown view source looks like this:



    <option selected="selected" value=""></option>

       <option value="1995">1995</option>

       <option value="1994">1994</option>

       <option value="1993">1993</option>

       <option value="1992">1992</option>



    Gary
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The thing is, for working with drop down items, if you pass it a string, it will try and match the string to the items in the box.  If you pass it a number (like 1962), it will try and find the item that corresponds to that.  I'm sure you don't have one thousand nine hundred sixty-two items in your drop down so, if you passed it in as an integer, it would naturally return "item not found".
  • robertsg32's avatar
    robertsg32
    Occasional Contributor
    Robert,



        When I change 1962 to "1962"  I get Cannot perform ClickItem operation.



    Gary
  • robertsg32's avatar
    robertsg32
    Occasional Contributor
    SelectItem is not available.  When I change ClickItem to SelectItem it says "The object does not support this property or method"



    Gary
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    If a keyword test, could you post a screenshot of what you're doing?



    If a script test, could you put your code up here?  That sounds just generally odd.  



    Even if you're using a keyword tests, there's a script language that was selected.  What language are you using?
  • robertsg32's avatar
    robertsg32
    Occasional Contributor
    Hi Robert,



         I used value [set] instead of ClickItem and it works with dropdowns.

    Thanks for your time and help.



    Gary