<h1 class="style-scope group-search" data-group-search="false" style="display: none;">Searching...</h1>
我需要使用 selenium-java 获取从 false 变为 true 的值,因此我可以创建一个 preconditionWait 来等待该值返回 true,以便继续该方法。
最佳答案
由于缺乏 HTML 和上下文,很难为您找到可行的解决方案,但这是我最好的..
bool groupSearch = false;
while (!groupSearch)
groupSearch = Boolean.parse(driver.findElement(By.cssSelector(".style-scope.group-search")).getAttribute("data-group-search"));
// at this point in the code, the `data-group-search` will be `true`
关于java - 如何获取在selenium中返回 boolean 值的属性值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31735290/