18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Getting Text Then Storing to Substring
I am trying to get text from an element on a page then store parts of that text to other variables. The script looks like this right now:
var $one = _getText(_select("blank"));
var $two;
_set($two, $one.substring(8,15));
var $three;
_set($three, $one.substring(3,6));
I stepped through the code and the first line runs fine, but the second line I get an error. This code worked in a previous version of Sahi, but not V3.5. Can anyone suggest a different syntax please?
var $one = _getText(_select("blank"));
var $two;
_set($two, $one.substring(8,15));
var $three;
_set($three, $one.substring(3,6));
I stepped through the code and the first line runs fine, but the second line I get an error. This code worked in a previous version of Sahi, but not V3.5. Can anyone suggest a different syntax please?
Comments
I tried with this script and it is working fine.
And may i know,what $blank is because it looks like it hasn't been initialized anywhere. Which version of sahi you are using?
Also, what error are you getting and what browser are you using?
Regards
Theeran.
I am using IE 8 and Sahi V3.5
I am trying with the above code but it dint work
Here is my code:
var $one=_getText(_div("5 FOLLOWING"));//Here i have entered the name of the div.
var $two=$one.substring(1,1);
_click(_div($two+FOLLOWING));
Here i have to get the text from the div "5 following" as everytime the count keep incrementing i need to fetch the number from the text.
Can idea on this?
I think replacing the line: with should make it work for you.
Regards.