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.

Regular Expression for dynamic value

gopikannangopikannan Members
edited November -1 in Sahi - Open Source
Hi

Kindly give me regular expression for this dynamic value,

how to apply reg exp for thse,

_setSelected(_select("mdd[21]"), "F");

or

_setSelected(_select(81), "F");

Thanks
Gopi

Comments

  • TheeranTheeran Members
    Hi Gopikannan,

    Try with

    _setSelected(_select("/mdd/[21]"),"F");

    Thanks,

    Regards,
    Theeran.
  • Hi Theeran,

    Thanks for your reply.

    My dynamic value here is "21" , not mdd

    First name is _setSelected(_select("mdd[21]"), "F");

    second name is _setSelected(_select("mdd[25]"), "F");

    like this it will vary..

    Thanks
    Gopikannan
  • TheeranTheeran Members
    Hi gopikannan,

    The dynamic values are unique and they need to be stated, to access the element with that particular id.

    You can also try with _near, _under, _in APIs like below,

    _setSelected(_select("/mdd/",_near("nearbyElement")),"F");

    to access the element with reference to another element.

    Thanks,

    Regards,
    Theeran.
  • Hi Theeran,

    Thanks for your reply..

    Here i am explaining my working code below.

    _setSelected(_select("mdd[22]"), "R", _in(_cell(("/DJLmf.*/"), _under(_cell("Normal Saline (sodium chloride) [Add Note/Alert] | [Add/Delete Therapeutic Interchange]"))))); //its selecting R from the drop down

    In above code "Normal Saline (sodium chloride)" is parameter value, and mdd[22] will vary based on the parameter value.

    So i want '22' to use regular expression or kindly give me suggestion on this.

    Thanks
    Gopikannan
  • TheeranTheeran Members
    Hi Gopi,

    Were there are multiple dropdown in cell "/DJLmf.*/" and under cell "Normal Saline"?

    If not, try with

    _setSelected(_select(0,_near(elementId),_under(elementId))"R");

    This will select option "R" from dropdown in cell "/DJLmf.*/" under cell "Normal Saline".

    Please go through my reply in the post

    http://sahi.co.in/forums/viewtopic.php?id=3977

    to use _under with _setSelected.

    Thanks,
    Theeran.
  • Hi Theeran,

    Fantastic support from you and your team..

    Working perfectly with below your below code.

    _setSelected(_select(0,_near(elementId),_under(elementId)),"R");

    Thanks
    Gopikannan
Sign In or Register to comment.