如何在不使用select类的情况下选择特定的下拉名称?

时间:2019-07-16 07:21:26

标签: selenium-webdriver

input class =“ dxeEditArea dxeEditAreaSys” name =“ ctl00 $ MainContent $ ddlApprover” value =“ ALEXANDER MANIQUIZ(FSO.PHI.FPHI.HR)” id =“ MainContent_ddlApprover_I” onchange =“ aspxETextChanged('MainContent_ddlApprover')” onblur =“ aspxELostFocus('MainContent_ddlApprover')” onfocus =“ aspxEGotFocus('MainContent_ddlApprover')” type =“ text” onkeydown =“ aspxEKeyDown('MainContent_ddlApprover',event)” style =“” autocomplete =“ off” readonly =“” xpath =“ 1”

class =“ dxeListBoxItem” id =“ MainContent_ddlApprover_DDD_L_LBI4T0” xpath =“ 1”>丽塔(Rieta Ed Brian)Tabaqua(FSO.PHI.FPHI.CEBU)

我的代码。

driver.findElement(By.xpath(“ // input [@ id ='MainContent_ddlApprover_I']”))。click();         列表选项= driver.findElements(By.xpath(“ // input [@ id ='MainContent_ddlApprover_I']”)))

    for(WebElement option : options)
    {
        if(option.getText().equalsIgnoreCase("Rieta Ed Brian Tabaqua (FSO.PHI.FPHI.CEBU)"))
        {
             option.click();


}

0 个答案:

没有答案