How to match an element if only previous element is certain?
I have to match an element which gets its element id and name attributes generated with a random number every time the page is loaded, Class attribute is very generic and is common across multiple input tags (as seen in screenshot as well). The only thing certain is the label element before it (screenshot attached). I need to match the input tag to populate it at run time. Is there a way to match this element based on its adjacent element?
One approach i was thinking was to match the label with inner text and then get its 'for' attribute. Then use this attribute's value to match input tag. However, since there is no way to change match rules at run time so I am stuck now. Please help.
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.