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.

Hidden elements value is invisible to _assertContainsText

voleynikvoleynik Members
We are using Sahi to test UI in our web app which deals with HTTPS, certificates, multiple re-directs, accessing multiple domains, a lot of tokens and HEADER values, etc.
For example - as a result of one user click HTTPS traffic goes back and forth to 4 different sites all over the world.

We tried to use Selenium, but it gets confused and CAN NOT play its own recorded script.

Sahi on the other hand, after installing all needed certificates, works fine.

We also actually trying to use Sahi as load/performance testing tool.
The batch invocation works ok, but if we run 10000 test cases in 10 threads on a single machine, the number of open TCP/IP sockets grows very fast and Sahi gets confused. We probably need to learn how to tune it.

Looks like we will definitely use Sahi for functional UI test.

But, on the other hand, we will watch as it evolves to adjust it for load/performance tests.

One thing that we noticed is that we can not use assert for the text inside hidden elements:

Example:

for this element

<input type="hidden" name="act" value="[9999010000000082]">

the code _assertContainsText("0082", document.body);

can not find it.

Any suggestions would be greatly appreciated.
Regards,
Vladimir.
San Jose, California.
Tagged:

Comments

  • narayannarayan Administrators
    Vladimir,

    Thanks for the post.

    containsText APIs look at the text version of HTML which will not have the hidden fields.
    You could use _assert(_containsHTML("0082"), document.body), but that is not the best way to do it.

    Better to do it as _assert(document.form1.act.value.indexOf("0082") != -1); which points exactly to the hidden element. (Replace form1 with your form's name.)

    I am also adding an API for hidden fields in the coming build. If you need it currently do the following:

    Add this to the end of sahi/htdocs/spr/concat.js
    Sahi.prototype._hidden = function (n, inEl) {
        return this.findElement(n, "hidden", "input", inEl);
    };
    

    And add _hidden at the end of sahi/config/normal_functions.txt

    Restart Sahi and you can use it like this:

    _assert(_hidden("act").value.indexOf("0082") != -1)

    Regards,
    Narayan
  • Thanks a lot we are up and running.
This discussion has been closed.