Objects with dynamic ID

I need to add text to a text-area. The problem is that this specific text-area is always generated with a brand new ID every new session in the platform I’m testing so it doesn’t matter how I record my test, findTestObject will never find the text-area I want to use because it gets a new ID everytime.

I thought of using JavaScriptExecutor in this fashion but I believe the syntax is completely wrong:

WebUI.executeJavaScript("arguments[0].value = ‘Some random text’; ", Arrays.asList(document.querySelectorAll(‘goal-summary:nth-of-type(1) textarea’)))

Does anyone know a way around objects with dynamic IDs?

Have you tried finding it by using attributes or xpath? Maybe using attributes works for you, e.g. tag = input, type = text …

I did. That solved the problem. Didn’t have to change the script, just the attributes of the test object. Thanks!

You’re welcome. I actually never use xpath. For me using attributes works so much better :slight_smile: