如何等待CSS属性更改? [英] How to wait for a css attribute to change?

查看:114
本文介绍了如何等待CSS属性更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何告诉Selenium Webdriver等待特定元素以在CSS中设置特定属性?

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

我要等待:

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

通常,人们会等待这样的元素出现:

Usually one waits for elements to be present like this:

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

如何等待display属性的特定CSS值?

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

推荐答案

我认为这对您有用.

webdriver.wait().until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='some_input'][contains(@style, 'display: block')]")));

这篇关于如何等待CSS属性更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆