I’m trying to change DatePicker’s HTML markup in Apache Wicket.
What I have for now:
public CustomDateTextField(final String id, IModel<T> model, Class<T> type, String modelPath) {
super(id, model, type, modelPath);
addDatePicker();
}
And this one uses default markup. For example, to initialize this one I use this Java code:
CustomDateTextField<?> textField = new CustomDateTextField(field, model.bind(field), pathPrefix + "." + field);
And this HTML markup:
<input wicket:id="date" name="date" type="text" size="10" maxlength="10" />
But for testing automation I want to have unique ID available on UI. I mean, if I will inspect my datePicker on UI now, I will have:
<img style="cursor: pointer; border: none;" id="date53Icon" src="resources/org.apache.wicket.extensions.yui.calendar.DatePicker/icon1.gif" alt="" title="">
But I need to make this specific datePicker unique. For example, I can add to html name=”apocalypseDate”, but to do that I need somehow extract the markup. And now i’m quite confused how to do that.
Thanks in advance!
The id is always the component id of the component and Icon (that’s why you get
date53Icon), defined inDatePicker#getIconId. Unfortunately this method is final, so you can’t override it. But you can set the id of the textField:The id of the image will then be
textFieldIcon.