How to set d field to some text if the field has a dynamic id?

How to set d field to some text if the field has a dynamic id?

51

Thanks in advance.

@kreal, you will need to identify and get reference to the <input> element using some other attribute, like class and/or using the ID or Class of its parent/previous element.

We will need the actual HTML above what you have shown to be of more specific help, but here's an example.

<div class="myform">
   <input type="text" id="blah blah" name="blah blah">
</div>

Then you could use this JavaScript:

var inputElem = document.querySelector('div.myform input');
inputElem.value = 'New value';

This is ALL UNTESTED and may contain errors. It is meant to just give you some idea of how to proceed. If you will provide the actual HTML then I'll provide a better answer.

Hey @JMichaelTX

Here is the actual HTML code of the element, there is no class or other identifier which I can use to select the element, only dynamic id and dynamic name.

14

Hey @JMichaelTX

I still haven't found a solution to select/focus/click element with dynamic id/name/class

Is there a way to do this if element id/class or name match regex pattern?

UserVerificationFieldValue[2720703][message]

Finally I have found a solution:

Run Javascript:
document.getElementsByTagName('Tag Name')['position of the tag'].focus or .click or .innerText();