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.
Sahi Java Client : method collectSimilar() behaviour and usages
Hi
I am using Sahi Java Client, I came across a method collectSimilar.
Description:
public java.util.List<ElementStub> collectSimilar()
Returns a list of element stubs similar to this one.
Sample Code :
0. net.sf.sahi.client.Browser sahiBrowser = null;
1. sahiBrowser.open();
2. sahiBrowser.navigateTo(url);
3. ElementStub tempEleStub = sahiBrowser.byClassName("my_className");
4. List<ElementStub> collElestub
5. collElestub = tempEleStub.collectSimilar();
6. collElestub.get(0).click();
The Line 6 gives error.
Used collectSimilar() at Line 5, and got more that 1 ElementStub. But failed to use as shown above. So Kindly suggest how to use the n-th ElementStub from the collection.
Thanks
Sandeep
I am using Sahi Java Client, I came across a method collectSimilar.
Description:
public java.util.List<ElementStub> collectSimilar()
Returns a list of element stubs similar to this one.
Sample Code :
0. net.sf.sahi.client.Browser sahiBrowser = null;
1. sahiBrowser.open();
2. sahiBrowser.navigateTo(url);
3. ElementStub tempEleStub = sahiBrowser.byClassName("my_className");
4. List<ElementStub> collElestub
5. collElestub = tempEleStub.collectSimilar();
6. collElestub.get(0).click();
The Line 6 gives error.
Used collectSimilar() at Line 5, and got more that 1 ElementStub. But failed to use as shown above. So Kindly suggest how to use the n-th ElementStub from the collection.
Thanks
Sandeep
Answers