У меня есть SelectList с HTML:Выбор опции из SelectList используя WatiN вопрос
<select style="background-color: rgb(255, 255, 255);" id="advFindE_fieldListFLDCTL" class="ms-crm-SelectBox" Sort="ascending" defaultSelected="-1">
<optgroup id="fld" label="Fields">
<option title="Case" value="il_caseid" datatype="lookup" namemaxlength="200" nameattr="il_caseidname" lookupstyle="single" lookuptypenames="il_protectionworksheet:10093:Protection Worksheet" lookuptypes="10093">Case</option>
<option title="Created By" value="createdby" datatype="lookup" namemaxlength="320" nameattr="createdbyname" lookupstyle="single" lookuptypenames="systemuser:8:User" lookuptypes="8">Created By</option>
...
<optgroup id="ent" label="Related">
...
</optgroup></select>
И для жизни я просто не могу выбрать «созданный» вариант через WatiN. Я не уверен, что это из-за элементов optgroup или что. Я попробовал почти Everyway я могу думать о таких, как:
advancedFindWindow.Frame(CRMConstants.contentIFrame).SelectList("advFindE_fieldListFLDCTL").Option("Created By").Select();
или
advancedFindWindow.Frame(CRMConstants.contentIFrame).SelectList("advFindE_fieldListFLDCTL").Option("Created By").Click();
или
advancedFindWindow.Frame(CRMConstants.contentIFrame).Div("advFindE_fieldListFLDLBL").Focus();
advancedFindWindow.Frame(CRMConstants.contentIFrame).Div("advFindE_fieldListFLDLBL").Click();
Thread.Sleep(250);
advancedFindWindow.Frame(CRMConstants.contentIFrame).SelectList("advFindE_fieldListFLDCTL").Focus();
advancedFindWindow.Frame(CRMConstants.contentIFrame).SelectList("advFindE_fieldListFLDCTL").Click();
SendKeys.SendWait("Created By");
Thread.Sleep(1000);
SendKeys.SendWait("{ENTER}");
Однако ни один из них не похоже на работу. Последняя попытка делает выбор, но по какой-то причине он выбирает совершенно другой вариант. Я совершенно не знаю. Любые идеи были бы полезны.
Попробуйте это решение: [введите описание ссылки здесь] [1] [1]: http://stackoverflow.com/questions/15236339/select-each-item-in- выпадающий-список, использующих-WatiN –