I've been trying to get Selenium IDE working with the SmartGWT application we are building and we seem to be having lots of problems. Specifically, submitting a DynamicForm with required fields and using .validate() does not work as expected - validate() fails thinking that the required fields are empty while I can clearly see that the Selenium IDE populates the fields with type command.
Here is a simplified code block for the log in form. It works just fine when done by hand but running Selenium script fails validation by resetting the login and passwor fields to blank and flagging each field as "required".
If I remove .setRequired(true), Selenium IDE script runs just fine taking both fields' values and passing further to the server. Same story (works great) if I just remove the loginForm.validate() -- fields' values are sent to the server. I can't explain why validate() doesn't like Selenium's populated fields.
Thanks.
Here is a simplified code block for the log in form. It works just fine when done by hand but running Selenium script fails validation by resetting the login and passwor fields to blank and flagging each field as "required".
If I remove .setRequired(true), Selenium IDE script runs just fine taking both fields' values and passing further to the server. Same story (works great) if I just remove the loginForm.validate() -- fields' values are sent to the server. I can't explain why validate() doesn't like Selenium's populated fields.
Code:
String PAGE_BASE_ID = "login" DynamicForm loginForm = new DynamicForm(); loginForm.setID(PAGE_BASE_ID + "_form"); TextItem userLoginItem = new TextItem(); userLoginItem.setTitle("Login"); userLoginItem.setRequired(true); PasswordItem passwordItem = new PasswordItem(); passwordItem.setTitle("Password"); passwordItem.setRequired(true); userLoginItem.setName("LOGIN_FIELD"); passwordItem.setName("PASSWD_FIELD"); Button loginButton = new Button("Login"); loginButton.setID(PAGE_BASE_ID + "_loginButton"); loginForm.setFields(userLoginItem, passwordItem); VStack pageBody = new VStack(); pageBody.addMember(loginForm); pageBody.addMember(loginButton); loginButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if(loginForm.validate()){ login(); //mockup, actually an RPC call goes here } } } );
Comment