What to use instead of CONTAINS() in CSS3

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 14:35:34

问题


Question about automation. I use Selenium RC.

I upgraded my FF to 3.6.18 and it seems that it can't find any locators which have "contains()" inside

I've read alot of forums. It's a known problem, but I did not find any solution.

So what to use instead of contains() now?


回答1:


The only functionality in CSS which is similar to contains() is:

element[attribute*="substring"]

It is helpful when you need to check some substring which contains in the attribute.




回答2:


You can use jQuery :contains(text)

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

<script>
    $( "div:contains('foo')" ).css( "text-decoration", "underline" );
</script>


来源:https://stackoverflow.com/questions/6648238/what-to-use-instead-of-contains-in-css3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!