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.
Extracting all Elements in Array
In a page there are multiple textboxes with same name.
Sahi identify them by apending incremental index like:
Tb
Tb[1]
Tb[2]
How can i capture all textboxes in one array?
I have read artical http://www.w3schools.com/htmldom/dom_obj_form.asp but still i am confused that how to implement it in sahi.
Sahi identify them by apending incremental index like:
Tb
Tb[1]
Tb[2]
How can i capture all textboxes in one array?
I have read artical http://www.w3schools.com/htmldom/dom_obj_form.asp but still i am confused that how to implement it in sahi.
Tagged:
Comments
If you can access the elements by Tag or class, you can use document.getElementsByTag/ByClass etc
Check if regular expression works for document.getElementsById
var $a = document.getElementsByName("seld_1");
_alert(_getText($a));
and it shows undefined. Am i going in right direction?
document.getElementsByName returns an array of objects. Hence you need to use something like $a[0] to access the first element that is returned. So, in your code if you change the second line to it should properly display the content
Since you are trying to access drop down boxes, you could use to get an array of objects and then that can be manipulated as discussed above
var $a = document.getElementsByTagName("SELECT");
_alert($a.length);
It returns 0 while more than one dropdown list is present on page. I am also posting properties of one of the dropdown list which i have taken with sahi object spy
scrollHeight=22;
currentStyle={{[object]}};
currentStyle=[object];
document={{[object]}};
document=[object];
isMultiLine=true;
clientHeight=22;
parentTextEdit={{[object]}};
parentTextEdit=[object];
clientWidth=49;
parentElement=[object];
scopeName=HTML;
outerText= NoYes;
innerText= NoYes;
tagName=SELECT;
offsetWidth=49;
contentEditable=inherit;
runtimeStyle={{[object]}};
runtimeStyle=[object];
filters={{[object]}};
filters=[object];
offsetLeft=1;
style={{[object]}};
style=[object];
canHaveChildren=true;
behaviorUrns={{[object]}};
behaviorUrns=[object];
readyState=complete;
all={{[object]}};
all=[object];
sourceIndex=416;
outerHTML=<SELECT onchange="Functionncalling()" size=1 name=selStrapUsed_2> <OPTION value=NO>No</OPTION><OPTION value=YES selected>Yes</OPTION></SELECT>;
innerHTML= <OPTION value=NO>No</OPTION><OPTION value=YES selected>Yes</OPTION>;
offsetHeight=22;
scrollWidth=49;
offsetTop=1;
offsetParent=[object];
children={{[object]}};
children=[object];
firstChild={{[object]}};
firstChild=[object];
value=YES;
length=2;
lastChild={{[object]}};
lastChild=[object];
ownerDocument={{[object]}};
ownerDocument=[object];
nodeName=SELECT;
attributes={{[object]}};
attributes=[object];
parentNode=[object];
nodeType=1;
form={{[object]}};
form=[object];
childNodes={{[object]}};
childNodes=[object];
size=1;
type=select-one;
name=selStrapUsed_2;
selectedIndex=1;
0={{[object]}};
0=[object];
1={{[object]}};
1=[object];
Functions
onchange
Do