Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to wait for a css attribute to change?

How can I tell Selenium webdriver to wait on a specific element to have a specific attribute set in css?

I want to wait for:

element.getCssValue("display").equalsIgnoreCase("block")

Usually one waits for elements to be present like this:

webdriver.wait().until(ExpectedConditions.presenceOfElementLocated(By.id("some_input")));

How can I wait for the specific css value of display attribute?

like image 765
membersound Avatar asked Dec 05 '22 07:12

membersound


1 Answers

I think this would work for you.

webdriver.wait().until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='some_input'][contains(@style, 'display: block')]")));
like image 164
Richard Avatar answered Dec 06 '22 19:12

Richard