Selenium Automation:- Control ids keep changing

I am doing automation using selenium ,  i found that control ids keep changing whenever there is a new addition to the form or if we update the theme.

 The Control ID is the unique internal numeric identifier. It is generally the best method of identifying controls.

Since control ID is changing my original scripts are getting failed. 

Please suggest any solution to work on it. Thank you.



You'll have to use a different identifier in your scripts.

Consider adding a property with a value that can be static and known to you in the Extended Properties.


Hello Joao, Thanks for your reply.

This will be from developer's side. They need to set this custom attribute on each field, I think this is not the good way from tester's side.

And also In Selenium, controls are identified by ID, Name and Classes in XPath query language.

Reshma, You can try Epimetheus from the forum.

Hi Reshma,

This can be done at Selenium end itself by using Xpath . So for below  example  you can select the element  by Xpath rather then by ID or name if they are dynamic

So in below case Xpath would be 






             <input type="text"  id="fname_32" name="fname_32">







@Reshma, Joao is right adding a property is the most reliable way to go.  Devendra's idea is good and will work, but you have to update tests whenever screen structure changes.

I find the simplest most reliable way is to add classes to identify components.  This way you can work with classes which is easier in Selenium.

If you are working separately from developers, then yes, this would be something done in Service Studio. It is quite a common practice nowadays to add identifiers in HTML to make automated tests less brittle.

Hope this helps!

I noticed that when an element has a name set the id generated by OutSystems ends in that name, and when it doesn't it ends in a number that might not be stable. For example, given an input field named SearchInput, these are the generated HTML name and id values:



A neighboring input field without a name set has it's name element end in $wt10 and it's id element end in _wt10.

Has anyone had success using an ends-width match element like 


It would be less burdensome to require developers to give names to elements we want to select on with a tool like Selenium than it is to add custom attributes.

If that doesn't work and it is common practice to add extra identifiers for stable selection, it would be awesome if OutSystems generated data-os-id="guid-hash or some other stable per-element id".