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.

Add new fields that modify the form, solutions?

interopeninteropen Members
edited November -1 in Sahi - Open Source
Hi,

We are working to implement Sahi in order to test Adempiere, but find some issues as Sahi test base on position number as we can see in this example that test an order creation:
<pre>_include("adlogin_test.sah");
_click(_span("z-tree-ico z-tree-root-close[3]"));
_click(_span("z-tree-ico z-tree-tee-close[18]"));
_click(_image("mWindow.png[145]"));
_click(_image("New24.png"));
_click(_image("spacer.gif[2]"));
_click(_cell("Fertilizer"));
_click(_image("spacer.gif[3]"));
_click(_cell("POS Order"));
_setValue(_textbox(9), "Standard");
_click(_image("spacer.gif[14]"));
_click(_cell("Fertilizer[1]"));
_click(_image("spacer.gif[23]"));
_click(_cell("Standard[1]"));
_click(_image("spacer.gif[26]"));
_click(_cell("GardenAdmin"));
_click(_image("Save24.png"));
_click(_submit("Order Line"));
_click(_image("Product10.png"));
_click(_image("Refresh24.png[1]"));
_click(_div("Mary Consultant"));
_click(_image("Ok24.png"));
_click(_image("spacer.gif[51]"));
_click(_cell("Standard[3]"));
_click(_image("Save24.png"));
_click(_link(4));
_click(_link("Log Out"));
</pre>

In a program as Adempiere that is base on an Application Dictionary, forms,reports,etc... are build on the fly for every user without the need even to reboot the server, so changes in fields are very common, even when you add a new module or small update.

So we find Sahi very useful to test our Webui ZK interface, but the problem comes when the test is done and later one of the fields in the testing role is added or modified.

This problem may be solve with strict rules in test creation and management in every release, but there is any other way within Sahi to solve it?

Regards,

Ivan Calderon

Comments

  • narayannarayan Administrators
    Hi Ivan,

    It is advisable to avoid index based identifiers as much as possible.
    Try and use _near and _in APIs instead.

    For example, to get a spacer.gif near, say, _div("Mary Consultant")

    you could use

    _image("spacer.gif", _near(_div("Mary Consultant")))

    This makes the script readable and will not break if new elements are added in between.

    If you point me to a sample web page, I can demonstrate with real examples.

    Regards,
    Narayan
  • Hi Narayan,

    That looks like a very interesting solution to research, i do it.

    For you to demonstrate with real examples, you can test it here:

    testadempiere.com/webui

    Just login as SuperUser, GardenAdmin role and create a sales order you have in favorites.

    Regards,

    Ivan
  • Hi Narayan,

    I have research it and clarify your solution here:

    http://www/adempiere.com/index.php/PMC:QA:Sahi_for_a_dynamic_fields

    Thanks for the help,

    Ivan
This discussion has been closed.