How to find out component-path
wicket
Solution
If you have the component you can call `#getPageRelativePath()`. E.g.
// Supposing c is a component that has been added to the page.
// Returns the full path to the component relative to the page, e.g., "path:to:label"
String pathToComponent = c.getPageRelativePath();
You can get the children of a markup container by using the `visitChildren()` method. The following example shows how to get all the `Form`s from a page.
List<Form> list = new ArrayList<Form<?>>();
Page page = wicketTester.getLastRenderedPage();
for (Form form : page.visitChildren(Form.class)) {
list.add(form);
}
Problem
I use junit to assert the existing of wicket components: ``` wicketTester.assertComponent("dev1WicketId:dev2WicketId:formWicketId", Form.class); ``` This works for some forms. For complex structure, it is defficult to find out the path of the form by searching all html files. Is there any method how to find out the path easy?