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.

Is Internationalization testing possible with Sahi

SamsirsameerSamsirsameer Members
edited November -1 in Sahi - Open Source
Hi,

Suppose I have script recorded in English locale.

Is there any provision in SAHI to run the same script in other locale like Japanese, Chinese.

Thanks,
SamsirSameer

Comments

  • Please reply whether internationalization testing is possible with Sahi?

    Scenario:
    1. Script is created in English locale.
    2. Application locale is changed from English to Japanese
    3. Now run the Script (recorded for application which was in English locale) on the Application which is on Japanese locale.

    Is this possible with Sahi???


    Thanks,
    Samsirsameer.
  • narayannarayan Administrators
    Yes, if you do either of these:

    Write your scripts based on ids and attributes not dependent on locale.
    or
    Externalize the script itself so that all locale specific strings in the scripts are picked from a file based on locale.

    I would recommend the first option. Email me if you need a way to ignore locale specific information while recording.

    Regards,
    Narayan
  • > Write your scripts based on ids and attributes not dependent on locale.

    According to the Sahi API documentation, _setSelected does not take an attribute value to select an option, only the option text which is locale dependant. I'm new to sahi, any solution for this?
  • narayannarayan Administrators
    gbremer,

    You can use the text, id or index of the option.
    Updated documentation. Thanks for pointing out.

    Regards,
    Narayan
  • Second parameter for _option must be a (localized) text according to documentation. Id attribute value doesn't seem to work in my tests. Is there a solution to check if an option is selected without using text, but ids?
  • narayannarayan Administrators
    What version of Sahi are you using? You could try the latest, which we released today.
  • I'm using the before today version. I will try the new one. Thanks.
  • The _option issue is the same with the new version from today.
  • narayannarayan Administrators
    gbremer,

    I just verified that it works. Have a look at http://sahi.co.in/demo/selectTest.htm.
    When I chose the second option it recorded as
    _setSelected(_select("s1Id"), "id2");
    
    id2 is the id of the second option.

    May be there is something different happening in your case. Can you paste the HTML code for the option? (Paste it within \[code\] \[/code\] tags).
  • Sorry a misunderstanding here. _setSelected works fine I agree. I mean the _option statement. Example: _option(_select($process_status_id), "all") where "all" is an id value.
  • narayannarayan Administrators
    Open sahi/htdocs/spr/concat.js and replace Sahi.prototype._option function with the code given below. I will add it to the next build.
    Sahi.prototype._option = function (el, val) {
        var opts = el.options;
        var l = opts.length;
        var optionEl = null;
        if (typeof val == "string" || val instanceof RegExp){
            for (var i = 0; i < l; i++) {
                var opt = opts[i];
                if (this.areEqual(opt, "text", val) ||
                    this.areEqual(opt, "value", val) ||
                    this.areEqual(opt, "id", val)) {
                    optionEl = opt;
                }
            }
        } else if (typeof val == "number" && opts.length > val){
            optionEl = opts[val];
        }    
        return optionEl;
    };
    

    Regards,
    Narayan
Sign In or Register to comment.