On a Wicket page, I produce links with images via the following:
@Override
protected void populateItem(ListItem<Club> item)
{
.开发者_如何学Python..
Image joinButton = new Image("joinButton", joinResource);
BookmarkablePageLink<PageClubJoin> joinLink =
new BookmarkablePageLink<PageClubJoin>("joinLink", PageClubJoin.class);
joinLink.setParameter("club", item.getModelObject().getId());
joinLink.add(joinButton);
item.add(joinLink);
...
The rendered html produces a series of
<a wicket:id="joinLink" ... />
elements.
Now, how do I use WicketTester to ClickLink on, say, the second one? They all have the same wicket:id.
You provide the full path to the component separated by colons:
tester.clickLink("listView:0:joinLink");
The first part is the list view component ID, the second the number of the item you want to select and the third part the link that you want to click. So if you want to click the link in the 99nth item in the list you would use:
tester.clickLink("listView:99:joinLink");
精彩评论