【问题标题】:How to emulate clicking on an AjaxButton in the wicket's test?如何模拟在检票口的测试中单击 AjaxButton?
【发布时间】:2020-12-25 09:21:17
【问题描述】:

我的测试中有以下代码:

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

我应该在最后一行写什么来强制 WicketTester 按下 AjaxButton?

【问题讨论】:

    标签: java unit-testing wicket


    【解决方案1】:

    使用'executeAjaxEvent':

    tester.executeAjaxEvent(button, "click");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-30
      • 2023-04-07
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 2017-06-14
      相关资源
      最近更新 更多