selenium - 如何等待值处于可选择状态
问题描述
嗨,我正在使用 Page Factory 将我的所有定位器保存在一个类中。
@FindBy(xpath="//select[@ng-model='selectedLeadSource']")
WebElement source_of_lead;
public Select getSourceOptions() {
return new Select(source_of_lead);
}
但我不能使用等待,因为它给我一个错误。
wait.until(ExpectedConditions.elementToBeClickable(onPage.getSourceOptions().selectByValue("Campaign")));
错误 :
ExpectedConditions 类型中的方法 elementToBeClickable(By) 不适用于参数(void)
解决方案
使用这个:: WebDriverWait wait = new WebDriverWait(driver, 100);
@FindBy(xpath="//select[@ng-model='selectedLeadSource']")
WebElement source_of_lead; element=wait.until(ExpectedConditions.presenceOfElementLocated(source_of_lead));
选择下拉=新选择(元素);dropdown.selectByValue("活动");
推荐阅读
- pdf - PDF 文件元数据的批处理编辑器
- logging - 如何将日志聚合到 splunk 中的持久表?
- html - Selenium 如何点击 50% 在屏幕上和 50% 不在屏幕上的元素?
- google-sheets - 在 Google 表格中,如何计算添加的项目数量
- java - RS232 - JSSC 2.8.0 串行端口阅读器 - 不明确的阅读
- javascript - 将yaml字符串转换为nodejs模块中的函数引用(不调用函数)
- python - 从多个连续动作中选择 1 个动作
- wso2 - 更改 WSO2 API Manager v3.0.0 的 UI
- android - Xamarin:无法解析引用:`System.Web`,由 [引用项目] 引用
- php - PHP : mail() - 发送多个主题