Unless you create your own widgets, to apply this, it is not supported by default. Every element gets an ID but depending on the rendering widget it will be more or less dynamic.
Perhaps an idea for the idea forum?
Hi, this is currently not possible with the current widgets. But you can vote for this idea: https://community.mendix.com/link/space/studio-pro/ideas/4809