I'm trying to select a value in my DDL list via the WatiN browser control debugging tool...
Here is my input item:
<input id="ProviderList" name="ProviderList" style="width:400px" type="text" /><script>
jQuery(function(){jQuery("#ProviderList").kendoDropDownList({"dataBound":dataBoundProviderList,"dataSource":[{"Key":"001","Value":"001 Provider 1"},{"Key":"002","Value":"002 Provider 2"}],"dataTextField":"Value","dataValueField":"Key"});});
</script>
I tried the following without success to preselect the 2nd item in my unit test:
TextField providerListElement = Browser.TextField(Find.ByName("ProviderList"));
//via a jquery script from WatiN:
Browser.Eval("$\"#ProviderList\").data('kendoDropDownList').value(\"002\");");
// or another attempt via WatiN using jquery:
var dropdownlist = $(\"#ProviderList\").data(\"kendoDropDownList\"); dropdownlist.select(function (dataItem) { return dataItem.symbol === \"002\";});");
// and one more try:
Browser.Eval("$(document).ready(function() { " +
" var dropdownlist = $(\"#ProviderList\").data(\"kendoDropDownList\"); " +
" dropdownlist.select(function (dataItem) { return dataItem.symbol === \"02\"});" +
"}); ");
//also tried treating it as text field
providerListElement.Value = "002";
//as text field using simulated typing
providerListElement.TypeText("002");
Nothing seems to let the field change.
Any thoughts would be helpful!
Thanks,
Robert