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.

How to get the length of the arguments

ziscloudziscloud Members
edited November -1 in Sahi - Open Source
Hi all,

In the javascript, we can get the arguments's length using following code:

function myFunction()
{
alert(myFunction.arguments.length);
}

But in sahi, I tried this way:

function myTest() {
_alert(myTest.arguments.length);
}

myTest(1,2,3);

I got the type error: myTest is undefined.

I tried this:

function myTest() {
_alert(arguments.length);
}

myTest(1,2,3);

Sahi just give zero not three.

Anybody can help me!

Thanks a lot!

Comments

  • Hi,

    You can try it as,

    function myTest() {
    var $res = arguments.length;
    _alert($res);
    }
    myTest(1,2,3);

    and its important that you have to prefix a $ sign before variables which are passed to sahi functions because otherwise it will consider "res" as a string and not as a variable.
  • narayannarayan Administrators
    Small correction.

    When you write
    _alert(res);
    Sahi will search for the variable res on the browser (and will not get it)

    When you write
    _alert($res);
    Sahi will evaluate $res on the proxy and pass it to _alert on the browser.
  • Thanks,it is working
Sign In or Register to comment.