0
我試圖從保管箱中選擇一個值。我曾嘗試與XPath
和ID
,但似乎無法達成它無法從Selenium中的保管箱列表中選擇值
這是我試過
var mySelectElm4 = driver.FindElement(By.Id("ddlCountryOfBirth"));
var mySelect4 = new SelectElement(mySelectElm4);
mySelect4.SelectByText("Togo");
而且這個HTML
<div class="form-object">
<span class="error-star"></span>
<div class="field-description input-placeholder styled field-description-show">Country of birth</div>
<div class="field field-select">
<select name="ctl00$plcMainArea$ddlCountryOfBirth" class="field-data selectCustom watermark hasValue" validate="validate" data-rule-required="true" data-msg-required="This field is required." placeholder="Country of birth" id="ddlCountryOfBirth">
<option value="AF">Thailand</option>
<option value="BS">The Bahamas</option>
<option value="GM">The Gambia</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
<span class="selectCustomBox">
<span class="selectCustomBoxInner">Afghanistan</span>
</span>
</div>
<div id="ddlCountryOfBirth_e" class="error-message"></div>
<div class="clearfix"></div>
</div>
問題是第一行,我似乎無法找到... – AutDev
@AutDev iframe中的下拉菜單? – Guy
不,我不這麼認爲......如果那樣的話會改變什麼? – AutDev