18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

dynamic component id

edited November -1 in Sahi - Open Source
hi all,

i'm still new with this sahi and i often counter problem with dynamic component id
ex : when record stated "f29_nextBtn" but the id changes when running the script, i have to change the id manually and start the test again from the beginning :(

Is there any way to overcome this problem?
Thank you very much for any Inputs..........

Comments

  • narayannarayan Administrators
    Almost every element in the DOM can be accessed by multiple ways.
    So if the id is variable, use the button text, or index, or anything else which is constant.

    for eg., the second button on the html page rendered due to this snippet
    <input type="button" id="f29_nextBtn" value="Next">
    
    can be accessed by
    _button('f29_nextBtn')
    or
    _button('Next')
    or
    _button(1)
    
    Let me stress that the recorder is to ease your life. It may not give you the best suggestions. You will need to come up with ways to make tests repeatable. Do have a look at the APIs of Sahi, and experiment by modifying the accessor field and clicking on highlight in the controller.
Sign In or Register to comment.