Combobox - Is there a way to add id to an option? - (Vaadin 8)

Hi,

Is there a way to add (unique) ID to (each) items (options) of combobox?
Our tester would like to use them in Selenium automated tests.

Bye,
Peter

Not out of the box, as far as I know. You’d have to create a client-side Extension for that. It’s not great, but maybe you could create some kind of workaround with setStyleGenerator by creating a style name for each item?

-Olli

Hi,

Since you would like to test your app, I would strongly recommend taking a look at the
Vaadin Test Bench
which is based on Selenium.

BR,
Goran

Hello,
Thank you for ideas! It seems the unique style generation workaround is ok.

Anyway the test bench is a better option, but our company don’t have subscription. Yet. :slight_smile:

TestBench does have a lot of convenience functions for Vaadin applications in particular. I find the ability to wait for Vaadin to complete its thing very useful, too, as well as screenshot comparison.

The built-in helper methods in TestBench for dealing with the more complicated components can also save a lot of time in many cases. And time, as we know, is money :slight_smile: