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.
Opening folder tree with getElementsBy...
Can any one point me to an example for the common test of returning a collection or array by "getElementsByName"?
i do this regularly with VBS and QTP, but am trying to convert those scripts to Sahi.
For instance: I want to click on each of 200-500 closed nodes in different folder "trees" marked by <div class=abc id=img01n4><img src="plus.gif" title="xyz">definition of xyz</div>
Recording this just gives me 200-500 lines with every ID - useless unless I can use some glob or regex pattern of ID to return an array? I thought surely this has already been documented - but haven't seen any of the "getelement" functions in the help examples?
i do this regularly with VBS and QTP, but am trying to convert those scripts to Sahi.
For instance: I want to click on each of 200-500 closed nodes in different folder "trees" marked by <div class=abc id=img01n4><img src="plus.gif" title="xyz">definition of xyz</div>
Recording this just gives me 200-500 lines with every ID - useless unless I can use some glob or regex pattern of ID to return an array? I thought surely this has already been documented - but haven't seen any of the "getelement" functions in the help examples?
Answers
I have posted the code below for the next person to find, with less friction loss!
(I call the function 2-3 times, one for each of two nested levels.
A clone of the function handles a single node identified by DIV rather than SPAN.
I failed to open the topmost of each inner/second level node until I ran the loop "backwards" from top to bottom.
And I absolutely failed with no workaround (so far) to open the top most "zero-th" node, even though its id = "img157span1"