views:

38

answers:

2

I have an application which generates 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 ...

A: 

You can do this in Javascript, using the getStyle() code as described on quirksmode.

toby
Thanks, that's useful. I see how the currentStyle attribute / getComputedStyle method can be used from javascript. The problem then becomes how do I call javascript from Java? I'm hoping that I can do this with Rhino.
Shawn Lauzon
Take a look here: http://stackoverflow.com/questions/515417/how-to-access-objects-arrays-defined-in-javascript-from-java-applets
Shervin
A: 

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.

Shervin
Windmill seems heavyweight for what I need. If I can get this value with simply javascript, that should be enough.
Shawn Lauzon