Question

I'm very new to Selenium. I want to write Selenium test cases for GWT widget. I can wirte test case for HTML elements since they have id, but i'm not able to do the same in GWT. I want to test widgets such as textboxes, images, listbox etc.

Can anyone help me?

Thanks in advance, Gnik

Was it helpful?

Solution

Now I set debugId for the GWT widgets. Using that Id I can access the elements and test.

For eg. In UiBinder set id as <g:TextBox ui:field="textBox" debugId="userBox"

In the java code, textBox.ensureDebugId("userBox");

I can access these widgets in Selenium as follows,

selenium.type("gwt-debug-userBox", "testing");

OTHER TIPS

I don't know if selenium is the right tool to test GWT Widgets, I think there are special tools for that.

With Selenium you can automate the browser. If GWT doesn't provide ids for its html elements there are various other ways to locate your elements. For example you can use xpath or css selectors. Just check the Selenium documentation.

But again, be careful about what you want to test. You don't want to test that GWT Widgets create a proper Web application, that is done already. You probably want to use a special GWT test tool where you test the java side of your widget.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top