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.

Validating inputs in sahi

JustusingsahiJustusingsahi Members
edited November -1 in Sahi - Open Source
hi i am a new user of sahi, i would like to know how to validates inputs in sahi.. and how to implemnt it..

hope you can help me

tnx

Comments

  • Hi

    could you please explain further what you would like to achieve? What do you mean with validating input?
  • like for example sir validating email address , numbers if the user inputs the right numerical values not letters..

    thanks

    i just don't know yet how to use it
  • Hi Justusingsahi,

    Validation of user inputs can be done in sahi.

    To validate userinput,you can use function inside <browser></browser> Tags and call the function using _call(function()) API.

    For example:

    _setValue(_textbox("number"),1234);
    _call(isNumeric());
    <browser>
    function isNumeric(){
    var numericExpression = /^[0-9]+$/;
    var numberfield=document.getElementById("number").value;
    if(numberfield.match(numericExpression)){
    _alert("Numbers");
    }else{
    _alert("Not Numbers");;
    }
    }
    </browser>

    This will popup an Alert message box with "Numbers".

    Similarly the validation's can be done for any userInputs such as email,letters,empty field.etc.

    Regards,
    Theeran.
  • Thank you Theeran
    for helping me out...
    this will be a big help for me using sahi...
    i will try what you told me
    thanks a lot...
Sign In or Register to comment.