开发者

Mapping ui:field in GWT to generated code

I'm trying to get some automated UI testing going on a GWT application and I'm having trouble finding a way to track UI elements.

For example, I have the following:

<g:Button text="Submit" ui:field="submitButton" e开发者_如何学运维nabled="true" />

which generates:

<button class="gwt-Button" type="button">Submit</button>

Its a compiler error to set both ui:field and id (id is considered deprecated anyway) so the problem is that I have no easy way to select my submit button using something like selenium.

Is anyone aware of a way I can map the

ui:field="sumbitButton"

to the generated HTML?


After further investigation I've discovered that you can enable debugIds which are ment for testing purposes. If you add:

<inherits name="com.google.gwt.user.Debug"/>

to your *.gwt.xml file you can then set debugId on your ui elements as such:

<g:Button text="Submit" ui:field="submitButton" enabled="true" debugId="submitButton"/>

and also in the codebehind by using the ensure debug id method

submitButton.ensureDebugId("submitButton");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜