I’m currently working on automating some UI tests with Selenium and I’ve run into a bit of a snag. I’ve successfully located the specific ComboBox I need to interact with by using an XPath selector. However, I’m stuck on how to proceed with selecting a specific value from the ComboBox that matches certain criteria.
Here’s what I’ve done so far:
I used XPath to correctly identify and interact with the ComboBox on my UI.
From here, I’m unsure how to filter and select a particular value. Does anyone have suggestions or best practices on how to programmatically select an item from a ComboBox based on its text or another attribute? Any examples or guidance would be greatly appreciated!
It’s going to be some kind of JavaScript job with executeScript. If you know the item you want to select, something like combobox.value = selectThis in JavaScript should work. Vaadin TestBench has ready-made functionality for all this.
But if Playwright seems to work reasonably out of the box without any special support from the UI library whereas Selenium needs special support and still has occasional problem, then that might also be a sign of some significant architectural differences between Playwright and Selenium?