Forum Discussion

s5h's avatar
s5h
Contributor
12 years ago
Solved

Selecting an item from combobox/dropdownlist

Hi  I was wondering is it possible to select an item based on caption/index from a combobox/dropdown in a keyword test?  My combobox did not have the ClickItem method mentioned in other post...
  • anhhao_nguyentr's avatar
    12 years ago
    Hi Siobhan!

    Please check again your mapping item, you can find item's menthods by Method tab in Advanced view to make sure that the methods are avaiable.

    Hope this code can help you:



    /**Looking for a filter name in Filter Name dropdownlist*/

    function Verify_Filter_Name_Exist_In_List(filter_name)

    {

      try

      {    

        var Obj=Aliases["pageInventoryDetailReport"]["list_Filter_Name"];//list_FIlter_Name appears after user clicked on combobox

        var i;

        if(!Obj["VisibleOnScreen"])

        {

          Aliases["pageInventoryDetailReport"]["cb_Filter_Name"]["Click"]();// cb_Filter_Name is a combo box

        }   

        for(i=0;i<Obj["wItemCount"];i++)

        {

          if(Obj["wItem"](i)==filter_name)

          {

            return true;

          }     

        }

        return false;

      }catch(ex)

      {

        Messageshow=ex["description"];

        return false;

      }

    }