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.

Regular expression have bugs in sahi

ernest.jebaernest.jeba Members
edited August 2012 in Sahi - Open Source
Hi,


_assert(_isVisible(_link("Send New Mail[1]")));

the [1] will get changed every time. I have tried using the

_assert(_isVisible(_link(/Send New Mail\[[0-9]\]/)));

Its failing.

Comments

  • use

    _assert(_isVisible(_link("/Send New Mail/")));
  • ernest.jebaernest.jeba Members
    edited August 2012
    Globalworming,

    Thanks for your suggestion.

    As you suggested, I changed
    _assert(_isVisible(_span("Send New Mail[6]")));
    to
    _assert(_isVisible(_span("/Send New Mail/")));

    Unfortunately, its failing.

    Assertion Failed

    But it works for the zeroth index
    If i have to check

    _assert(_isVisible(_span("Send New Mail[0]")));
    I can replace with
    _assert(_isVisible(_span("/Send New Mail/"))); // This works

    Any other way to handle the above scenario?
  • thats uncommon, it totally should work... maybe try that one. if its failing, I can't figure out why

    _assert(_isVisible(_span("/Send New Mail\[[0-9]\]/")));
  • I think it should be like this:

    _assert(_isVisible(_span(/Send New Mail/)));

    The number between the brackets is added by sahi itself.
  • Well.. AFAIK there is no difference if you quote the regular expression or not.. well.. just that you have to escape different..

    but the outcome of
    _assert(_isVisible(_span(/Send New Mail/)));
    and
    _assert(_isVisible(_span("/Send New Mail/")));
    is equal
  • I believe this should work..

    _assert(_isVisible(_span("/Send .*New Mail/")));


    Regards,
    Bhavitha
Sign In or Register to comment.