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.
Using the property nameProp
Hi,
I have multiple customers, each customer will have their own logo on the application login screen. So I need to write a main script which need to assert the logo and execute that particular customer script.
So i want to use the property of the image "nameProp" which can get the image name of the given URL. Once i get the image name i can put it in an if block and move on.
Please let me know how to write the script to get the value of the property in runtime.
OS- Windows 7
Browser- IE 8
Sahi Build - Sahi Pro 3.6 (Build: 2011-05-31)
Thanks in advance
Sagar
I have multiple customers, each customer will have their own logo on the application login screen. So I need to write a main script which need to assert the logo and execute that particular customer script.
So i want to use the property of the image "nameProp" which can get the image name of the given URL. Once i get the image name i can put it in an if block and move on.
Please let me know how to write the script to get the value of the property in runtime.
OS- Windows 7
Browser- IE 8
Sahi Build - Sahi Pro 3.6 (Build: 2011-05-31)
Thanks in advance
Sagar
Comments
access the image with the Sahi Controller, then list the properties. Look for the property you need. With you can assign the property value to a variable which can be used in an if-condition
Regards
Wormi
sahi.setServerVar('\$name', _image("TSI").nameProp);
TypeError: '_sahi._image(...).nameProp' is null or not an object
No trace available
Below are the properties which i got:
nextSibling={{[object]}};
nextSibling=[object];
childNodes={{[object]}};
childNodes=[object];
nodeName=IMG;
currentStyle={{[object]}};
currentStyle=[object];
clientHeight=35;
style={{[object]}};
style=[object];
nodeType=1;
scopeName=HTML;
offsetWidth=218;
filters={{[object]}};
filters=[object];
scrollHeight=35;
isMultiLine=true;
offsetTop=10;
parentNode=[object];
tagName=IMG;
behaviorUrns={{[object]}};
behaviorUrns=[object];
parentTextEdit={{[object]}};
parentTextEdit=[object];
ownerDocument={{[object]}};
ownerDocument=[object];
offsetParent=[object];
parentElement=[object];
children={{[object]}};
children=[object];
readyState=complete;
contentEditable=inherit;
document={{[object]}};
document=[object];
sourceIndex=32;
runtimeStyle={{[object]}};
runtimeStyle=[object];
scrollWidth=218;
attributes={{[object]}};
attributes=[object];
offsetHeight=35;
clientWidth=218;
outerHTML=<IMG alt=TSI vspace=10 src="new/images/tsilogo.jpg">;
all={{[object]}};
all=[object];
fileModifiedDate=11/02/2012;
alt=TSI;
fileUpdatedDate=06/19/2012;
protocol=HyperText Transfer Protocol with Privacy;
vspace=10;
mimeType=JPEG image;
fileCreatedDate=11/02/2012;
loop=1;
src=https://192.168.142.18:6433/tsiweb/new/images/tsilogo.jpg;
complete=true;
width=218;
start=fileopen;
href=https://192.168.142.18:6433/tsiweb/new/images/tsilogo.jpg;
nameProp=tsilogo.jpg;
height=35;
fileSize=2870;
i used .alt, but it also gave same error.
sahi.setServerVar('\$name', _image("TSI").alt);
TypeError: '_sahi._image(...).alt' is null or not an object
No trace available
Below given is my script:
var $name;
_set($name, _image("TSI").alt);
if ($name="TSI")
{
_setValue(_textbox("loginName"), "admin");
_setValue(_password("passWord"), "tsi1@3$");
_click(_button("Login"));
_click(_link("Logout"));
}
else
{
_setValue(_textbox("loginName"), "admin");
_setValue(_password("passWord"), "aa22aa22@");
_click(_button("Login"));
_click(_link("Logout"));
}
I guess your image is changing? Then try relational accessors like _image(0, _in(_div("whereTheImageIs))).alt
Instead of _set you could try var x = _getValue($image.alt)
Regards
Wormi