How can I programatically test which CSS elements match my XHTML?
I have an application which gene开发者_开发问答rates XHTML documents which are styled with (mostly) static CSS. I'm currently using XPath and Hamcrest (Java) to verify that the documents are constructed correctly. However, I also need to verify that the correct CSS properties are matched. For example, I would like a test like this:
Given XHTML element Foo, verify that the property "text-transform:uppercase" is applied.
Ideally, I would like a Java framework that provides this. I've looked a bit at Selenium, but I don't see this type of functionality. Thanks ...
You can do this in Javascript, using the getStyle() code as described on quirksmode.
You can use Windmill to do this for you very easily. It is not a java framework, but it will work on any webapps, and IMO it is better than Selenium.
精彩评论