Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT id element is changing every time in selenium

Tags:

java

selenium

gwt

selenium.click("gwt-uid-204"); // this is recorded from Selenium IDE

I am clicking the check box in my (gwt) java application. The gwt-uid is changing ever time, so if the id changed then my element is not found in my apps. The regular expression is not working for me and I am not sure what I am doing wrong. Thanks for your help

selenium.click("gwt-uid-[0-9]);

I am using selenium 1.0.3, Java

like image 230
mar Avatar asked Mar 26 '11 20:03

mar


1 Answers

Many GWT elements comes with ensureDebugId (method on UIObject) to allow you to explicitly set Ids to elements for testing and debugging purpose. You also need to inherit the module

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

to make it work. The advantage of this is, you can remove the trace from the production deployment by removing the inherited module in during prod mode compile. Hence there wont be code changes to remove unnecessary Ids.

like image 58
Vinod R Avatar answered Oct 14 '22 10:10

Vinod R