How to find an element by id/key that includes something?

Hi everyone,

Suppose if I have different keys/ids like:

On the page, at once, only 1 id/key will be visible but I am not sure which will be visible on different pages out of them.
What is the best approach to check if any of the _selected id/key is visible on the app page?

Something like this;
await driver.execute('flutter:waitFor', find.byValueKey('catalog_filter_GarmentSize_option_*_selected'));
where * can be S, M, XL

I would try to find by XPath (don’t know if it’s acceptable here):

let el = await driver.elementByXPath("//<your_attribute>[contains(@text, 'catalog_filter_GarmentSize')]");

Is it ios or android ?

This question is for both the platforms i.e. IOS and Android.

In case of appium flutter driver, we have keys as the unique identifier instead of Xpath.

1 Like