以下是HTML
class =“ UI-Helper-Hidden-accessible”的样式表是
UI-Helper Handend-accessible {border:0;剪辑:rect(0 0 0 0);高度:0px;保证金:-1px;溢出:隐藏;填充:0;位置:绝对;宽度:0px;}
以下是我的代码
WebElement customerType = driver.findelement(by.id(“ form1:customertype_input”));选择select = new select(customerType);select.selectbyvisibletext(“ new to bank”);
当我尝试从下拉列表中选择“新的银行”时,我会获得异常元素,看不见:元素当前不可见并且可能无法操纵 - Selenium Web Driver
我尝试过WebDriverWait技术,但没有任何想法?
在您尝试选择它之前,我不认为该选项的文本实际上是可见的。尝试按值选择。
WebElement customerType = driver.findelement(by.id(“ form1:customertype_input”));选择select = new select(customerType);select.SelectByValue(“ n”);
但是,您可能需要实际单击选择器,然后才能选择一个选项。
WebElement customerType = driver.findelement(by.id(“ form1:customertype_input”));new WebDriverWait(驱动程序,15).ultil(ExpectConditions.elementTobeClickable(customerType));customertype.click();选择select = new select(customerType);select.SelectByValue(“ n”);