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.

Asserting Special Characters

prasanthiprasanthi Members
edited December 2009 in Sahi - Open Source
I am using sahi web tool for testing our application. I am finding difficulty in asserting special characters (like euro symbol).

For example ::

_assertExists(_cell("€144.00"));
_assertEqual("\u20ac144.00", _getText(_cell("€144.00")));
_assertContainsText("\u20ac144.00", _cell("€144.00"));

this assertion fails

Comments

  • narayannarayan Administrators
    Hi Prasanthi,

    €144.00 will have to be specified as \u20ac144.00 to Sahi. (Sahi uses \u encoding for non-ascii characters)

    Did you generate that assertion via Sahi or did you copy paste the Euro in your script?
    When I recorded for Euro, this is what I got

    _assertExists(_cell("\u20ac144.00"));
    _assertEqual("\u20ac144.00", _getText(_cell("\u20ac144.00")));
    _assertContainsText("\u20ac144.00", _cell("\u20ac144.00"));

    This was on Firefox and IE.

    Regards,
    Narayan
  • I recorded via sahi only.

    _assertExists(_cell("€144.00")); is because the cell name is like that.

    Sahi uses the "\u" encriptying that why we can see the "\u" instead of euro character in the next 2 lines
    _assertEqual("\u20ac144.00", _getText(_cell("€144.00")));
    _assertContainsText("\u20ac144.00", _cell("€144.00"));

    But on clicking the "Test" button it is saying "Syntax error ; missing".
    How can we assert the non ascii characters?..
  • narayannarayan Administrators
    Sahi should have recognized euro as \u20ac and not a literal euro. It is surprising that it did not.

    To make your script work, just replace Euro with \u20ac in your script.

    Regards,
    Narayan
  • ok thanks for the response
Sign In or Register to comment.