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.

switch case

vinilnarayanvinilnarayan Members
edited January 2014 in Sahi - Open Source
hi..
Is it possible to use switch case in sahi open source Version:V4.4??

If it is possible..how to use??

Best Answers

  • You can use all JavaScript statements in sahi.
    Please refer to JS tutorial for detailed syntax.
  • Hi vinil,
    Refer to this :- http://www.w3schools.com/js/js_switch.asp

    Here is also a sample code for reference:-
    _click(_image("spacer.gif[35]"));
    _set($a,_textbox(1).value);
    switch ($a)
    {
    case: "QA":
    canada(); //function call
    break;

    case: "form-police MN1 MN2":
    aus(); //function call
    break;

    case: "form-police":
    uk(); //function call
    break;

    default:
    _log("Error");
    break;
    }

Answers

  • At least I have been using 'switch' in my Java version of Sahi.
  • hi CKBhavitha...
    Can u plz attach the link from wer should I search.. I searched a lot, but thats not working with mine..
  • Small note about the sample code of CKBhavitha. Java version 7 and latter are supporting also Strings in switch-case. Earlier versions are supporting only Integer.
  • hi CKBhavitha , Sadana..


    Thank you for valuable information..
Sign In or Register to comment.