how to get an attribute value that returns a boolean in selenium how to get an attribute value that returns a boolean in selenium selenium selenium

how to get an attribute value that returns a boolean in selenium


It's hard to get a working solution for you with the lack of HTML and context, but here's my best..

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`


While searching for the text, that boolean may changes. So you can get the boolean value of the web element using getAttribute() method.

 WebElement element = driver.findElement(By.xpath("//h1[contains(text(),'Searching')]")); boolean isSearch = element.getAttribute("data-group-search");