How to emulate clicking on an AjaxButton in the wicket's test?

Viewed 103

I have the following code in my test:

    AjaxButton button = (AjaxButton) getTester().getComponentFromLastRenderedPage(path);
    Assert.assertNotNull(button);
    getTester().clickLink(button); // fails with exception "is not an instance of AbstractLink or IAjaxLink"

What should I write in the last line to force WicketTester to press AjaxButton?

1 Answers

use 'executeAjaxEvent':

tester.executeAjaxEvent(button, "click");
Related