<Select id="selectName" class="" data-placeholder="請選擇類型"name="product">
< option value="1">請選擇類型
< option value="2">百度
< option value="3">支付寶
< /select>
獲取方法:先定位select元素再定位下拉框中option的下標(biāo),定位需要的下拉框值。代碼示例如下:
WebElement sourceCategory = chrome.findElement( By.id("selSourceCategory")); //獲取來源下拉框
sourceCategory.findElements(By.tagName("option")).get(1).click();? //選擇option