Wicket static markup IDs

59 Views Asked by At

In developing an automated test script, our test team is struggling with the fact that Wicket creates it's own IDs that aren't necessarily stable or predictable.

We could go around and invoke setMarkupId manually on each field, but what I'd rather do is build a visitor that does it. But I'm wondering if that's safe in wicket and how I should go about it. Should I setMarkupId(getId())? What about components inside repeaters?

Or is there some handy-dandy setting I don't know about that tells wicket to provide a more dependable id?

Note - we're in wicket 6 if it makes a difference. I know, we should upgrade. We've told our superiors for years. But there's always something more important to do in their opinion, so they haven't let us.

1

There are 1 best solutions below

0
martin-g On
  1. You could use your own IMarkupIdGenerator
  2. Or you could just set the id in the HTML. Wicket won't generate anything if it is already provided
  3. You could use a visitor too

About repeating ids - it is up to you to make sure the ids are unique.