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.
value of variable not as expected
Sahi
Version : V3.5
Build : 2011-05-25 (change log)
Browser
Name : Mozilla Firefox
Operating System
Name : Windows XP
for (var i = 0; i < 10; i++)
{
$j = _heading4(i).innerHTML;
_alert($j);
_writeFile($j,"foo.txt");
}
For the previous example, the _alert() shows the value I expected (in this case an html anchor tag and end-tag) but what is written to the file "foo.txt" is "_sahi._heading4(0).innerHTML" (0 through 9).
Can anyone help me understand the difference?
Thank you very much,
James
Version : V3.5
Build : 2011-05-25 (change log)
Browser
Name : Mozilla Firefox
Operating System
Name : Windows XP
for (var i = 0; i < 10; i++)
{
$j = _heading4(i).innerHTML;
_alert($j);
_writeFile($j,"foo.txt");
}
For the previous example, the _alert() shows the value I expected (in this case an html anchor tag and end-tag) but what is written to the file "foo.txt" is "_sahi._heading4(0).innerHTML" (0 through 9).
Can anyone help me understand the difference?
Thank you very much,
James
This discussion has been closed.
Comments
While working with for loop in Sahi we have to make sure that we "do not use a condition which depends on a page’s DOM". For more Details regarding for loop:
http://sahi.co.in/w/for-loops
Use the following script:
Regards
Sumitra