【发布时间】:2021-03-15 15:03:27
【问题描述】:
我有一个简单的方法,它应该在多选中找到选定的选项并检查其值。这里是:
public void checkArticleCategories(String cat1, String cat2)
{
ElementsCollection options = $(byName("categories[]")).findAll(":selected");
options.find(value(cat1)).shouldHave(value(cat1), ofSeconds(14));
options.find(value(cat2)).shouldHave(value(cat2), ofSeconds(14));
}
但是.shouldHave(value(cat1) 抛出错误:
无效的选择器:指定了无效或非法的选择器
所有类型都是正确的。 shouldHave() 的参数是 Condition 类如预期和 value() 预期字符串。那么这有什么问题呢?
【问题讨论】:
标签: java selenium selector selenide