18 January 2026:


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.

Is there a way I could get a count of them?

MarvyMarvy Members
edited November -1 in Sahi - Open Source
If _span("Text") matches more than one element, will all matching elements be returned, or just the first? And if all are returned.

Comments

  • As far as I know, it will return the first match by default. You can find the 2nd match like this: _span("Text[1]")
  • if you say _Span("Text") only the element with property name or visible text as "Text" will be identified.
    If you say _Span("Text[1]") then only the element with property name or visible text as "Text[1]" will be identified. (there can be multiple spans with the same visible text "Text" in different screens, one will be identified as _span("Text") and the other as _span("Text[1]" so both of them are different.)

    if you want to identify any span with the name or visible text as "Text", you can do that by regular expression "/Text/"
    provided you set the strictvisibility to true
    i.e
    _setStrictVisibilityCheck(true);
    _click(_span("/Text/"))// code to click or rightclick or any action on the span
    _setStrictVisibilityCheck(false);
Sign In or Register to comment.