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 Generation Of Control ID

stevePolackstevePolack Members
edited November -1 in Sahi - Open Source
Hi folks,

I am trying to set a the value of a text box that changes each time the page is loaded. Such as the following:

_setValue(_textbox("customer[addresses_attributes][1348058693509][line_1]"), "234");

I have tried doing a regular match on this, but I can't seem to get it to work.

Is there a way of finding the control each time?

Kind regards,

Comments

  • Thanks Mr Raleigh Carpet Cleaning. However it does not resolve or address the above problem.
  • narayannarayan Administrators
    Hi Steve,

    Try with this

    _setValue(_textbox("/customer\[addresses_attributes\]\[.*\]\[line_1\]/"), "234");
    or
    _setValue(_textbox("/customer\\[addresses_attributes\\]\\[.*\\]\\[line_1\\]/"), "234");

    Square brackets have a special meaning in regular expressions. So they need to be escaped.

    Regards,
    Narayan
  • Hi narayan,

    Thank you for getting back to me quickly.

    The second solution works perfectly.

    Many thanks,

    Steve
This discussion has been closed.