Forum Discussion

mhienbinhphuoc_'s avatar
mhienbinhphuoc_
Occasional Contributor
12 years ago

ClickItem in drop-down list, error drop-down box cannot opened

Hi all,



My drop-down list is created by DevExpress as below:

<select id="drpTypes" name="drpTypes" style="width:220px" class="withClearFunctions select" tabindex="-1">

<option value="6c798e76-62ff-11e3-83e4-e89a8f431139">Interstate</option>

<option value="75389b4f-62ff-11e3-83e4-e89a8f431139">IntraState</option>

<option value="7e145854-62ff-11e3-83e4-e89a8f431139">etc</option>

</select>

<span class="select-value">Interstate</span>



+I find drop-down list by id.

+Call Click() method to open drop-down list

-->on GUI, drop-down list is not opened.

+Call ClickItem(i) to select item on drop-down list.

-->Log result is error: drop-down box cannot opened.



Code as below:

var ruleTypeList = page["NativeWebObject"]["Find"]("id", "drpTypes");

ruleTypeList["Click"]();

ruleTypeList["ClickItem"](1);



Please help me some suggestion for it.

Thanks,

Hien

1 Reply


  • Hi Hien,


     


    Did TestComplete obtain the target object? Check whether the ruleTypeList object exists before accessing it:




    //JScript


    var ruleTypeList = page["NativeWebObject"]["Find"]("id", "drpTypes");


    if (ruleTypeList.Exists)


    {


      ruleTypeList["Click"]();


      ruleTypeList["ClickItem"](1);


    }