質問

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