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.

_execute fails with Can't find method

dherbertdherbert Members
edited November -1 in Sahi - Open Source
Using the same .sah script on older versions of SAHI seems to work verys well. But trying to use the _execute() command on any of the newer versions of SAHI results in:
ERROR
Can't find method net.sf.sahi.util.Utils.executeCommand(string,string,number).

The Script:
_execute("explorer.exe", "true");

Running the SAHI file form the controller fails, but copying the command into the Record - Evaluate Expression windows, opens the explorer.exe but has a not at the bottom saying an exception was raised. The Sahi proxy logs no additional information.

I downloaded the latest Zip file, created the .sah file in userdata\scripts and ran the proxy from userdata\bin\start_sahi.bat - no modifications

sahi\lib does have ant-sahi.jar and decompiling the utils class in that jar has the method in question.

Please Help!!

Comments

  • Running _execute WITHOUT the "TRUE" flag seems to work.

    ie: _execute("explorer.exe");
  • narayannarayan Administrators
    Hi,

    _execute("explorer.exe", "true");

    should now be

    _execute("explorer.exe", true);

    I am not sure how it used to work before; we will check.

    Regards,
    Narayan
  • That works. Thank you for the prompt response. My scripts running the older variant of SAHI (SAHI PRO v1) did however have the True in Quotes and worked well as such.

    Please let me know what changed as I now have a lot of scripts to edit.
  • narayannarayan Administrators
    Hi dherbert,

    Open Sahi/htdocs/spr/lib.js

    Find:
    Sahi.prototype._execute = function (cmd, isSync, timeout) {
        if (isSync == null) isSync = false;
        if (timeout == null) timeout = 5*60*1000;
        return net.sf.sahi.util.Utils.executeCommand(cmd, isSync, timeout);
    }
    

    replace it with:
    Sahi.prototype._execute = function (cmd, isSync, timeout) {
        isSync = (""+isSync) == "true";
        if (timeout == null) timeout = 5*60*1000;
        return net.sf.sahi.util.Utils.executeCommand(cmd, isSync, timeout);
    }
    


    Restart Sahi, and your older scripts should also work correctly.

    We will add this to further releases.

    Regards,
    Narayan
This discussion has been closed.