문제

I am working With Coded UI,when automating an application I need to select and item from winlist which have special characters like (parentheses, # etc), default SlectedItemsAsString() method is not working for this situation, I have found that giving the selection as string array worked with SelectedItems() method, Here is the example:

string templatename = item.Name;
String[] SelectedTempList = { templatename };
uILvwDetailsList.SelectedItems = SelectedTempList;

Does any one have better idea to select the winlist item with special characters using SelectedItemsAsString() method?

도움이 되었습니까?

해결책

You can use the WinListItem.Selected() method. The string, typically, is the name property in Coded UI list items.

            WinWindow form1 = new WinWindow();
        form1.SearchProperties[WinWindow.PropertyNames.Name] = "Form1";
        WinList list = new WinList(form1);
        list.SearchProperties[WinList.PropertyNames.Name] = "listBox1";
        WinListItem listItem = new WinListItem(list);
        listItem.SearchProperties[WinListItem.PropertyNames.Name] = "2 -WinListItem with special characters !@%";
        listItem.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);

        listItem.Select();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top