Tag: selenium

Selenium testing RichFaces comboBox controls

Ok, so I’ve spent the last day and a half chasing down a really weird bug I was seeing with our Selenium integration tests.

Basically, we had a RichFaces rich:comboBox component – which gives you a thing that looks like a drop down combo box, but also allows you to type free-form text into it. It does fancy things like auto-completion, etc.

What I had was an ajaxValidator that would trigger when the “onblur” event was fired at the component. This was working fine when I’d try it manually, i.e. I could type something into the field, hit tab (or click away from the field or whatever), and the validation would update, showing that the field now had a value (instead of complaining about not having one).

However, when I tested it using Selenium, using selenium.type() I could see the input appear in the text box, but the validation message would never go away.

Something with the event system in the combo box is way messed up, and you should test it using something like:

selenium.typeKeys( your_elementcomboboxField, "Some text" );
selenium.fireEvent( your_elementcomboboxField, "blur" );

This simulates a user actually typing each letter in, like a human would do, rather than just setting the field value. You then fire the onblur event, so simulate the user leaving the field.