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.

JavaScript String includes() Method

Hi,
I need Help for Sahi scripting..
I am using JavaScript String includes() Method in sahi to find particular character in string. But it gives me an error as
"Logging exception: Cannot find function includes in object 687.12. [184 ms] [03:09:33.190 PM]
Cannot find function includes in object 687.12
."
Could anyone confirm on this. Can I use String includes() Method in Sahi ?

My code :

while( $String_NM.includes(","))
{
$String_NM= $String_NM.replace(',','');
}

Comments

  • Hi Abhi,

    Instead of includes(), try with the indexOf() and check.

    while($String_NM.indexOf(",")!=-1 ){

    $String_NM= $String_NM.replace(',','');
    }

    Hope this helps.
Sign In or Register to comment.