Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

Sahi Java Client : method collectSimilar() behaviour and usages

sndp2510sndp2510 Members
edited August 2014 in Sahi Pro
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

Answers

  • Which version are you using? I have been using v43 for long time and collectSimilar works well. But recently I upgraded Sahi to v5 and saw the same problem as you. So I guess this is a defect introduced from v44. The interesting thing is that the corresponding Sahi script function _collect and _count work well. So this should be a Java driver issue.
Sign In or Register to comment.