How to enter an input field using WicketTester?

I am writing a unit test for Wicket WebPage. I want to launch the page, enter in the box, click the link and then make some statements.

Looking at the WicketTester and BaseWicketTester APIs , I could not find any method that takes a path (for example, "form: input") to find an input field and allows text to be entered into it.

// set up WicketTester; create page tester.startPage(page); tester. // Type into input field - how to do this? tester.clickLink("form:continueButton"); // assert something 

Did I miss something? This seems like a pretty simple use case. You should not use WicketTester like this? (That would be surprising, given the existence of methods such as clickLink ().)

+6
java unit-testing wicket wicket-tester
source share
1 answer

Use FormTester :

 FormTester formTester = tester.newFormTester("form"); formTester.setValue("myformfield", "Hello Sailor"); 

Reference:

+9
source share

All Articles