Testing a Wicket application with Selenium IDE

Wicket and Selenium IDE

In development mode, Wicket generates id’s with the wicket namespace prefix. These id’s are dynamic and change everytime a page is rendered. This works fine until you try to record test scripts with Selenium IDE.

What Selenium basically does is use XPath queries against the wicket:id‘s, recording the value of those id’s. But next time around, when you try to playback the test script, it will fail beacuse the values of all of the wicket:id’s have changed.

One possible workaround would be to just use normal HTML id attributes. But this is very laborious and poses limitations on your HTML, CSS, and Javascript code, and also polutes the production code with a lot of unnecessary id attributes.

A more useful solution would be to make use of Wicket’s wicketpath attribute. Continue reading “Testing a Wicket application with Selenium IDE”