18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Clicking on the Images
Hello Narayan,
In my screen I have around 20+ Images which are Identified as
_image("New")
_image("New[1]")
_image("New[2]") and so on
But I need to use every where _image("New") only to click on that to create a new line and I tried with _near and _Under also that didn't worked
The button "+" is present in below _heading2("List of Roles") and near _link("View")
Can you please help me find out the common way to click
Regards
Anil Kumar Ravilla
In my screen I have around 20+ Images which are Identified as
_image("New")
_image("New[1]")
_image("New[2]") and so on
But I need to use every where _image("New") only to click on that to create a new line and I tried with _near and _Under also that didn't worked
The button "+" is present in below _heading2("List of Roles") and near _link("View")
Can you please help me find out the common way to click
Regards
Anil Kumar Ravilla
Comments
could you please provide the code you used for clicking and maybe the URL you are testing to get a fast solution. If I understood right, you click on a image, a new line is created with an image("New") while the other images are counted up ( image(New[1]). Is your _click(_image("New")) not working on the newly created images? Did you used the controller and tried to record clicking the images?
Thanks for your reply but my problem is
In my page I have 20 + sections and in every section i have "+ Image and I need to click on that to create a new line.
In First section Sahi Identifies as _image("New")
In next subsection or main section it increments the number. Now I want to click on sat suppose 5th section I need to use (_image("New[5]")
But I dont want to be and I need to use image("New") only .
As if tomorrow if some new sub or main section comes in between 5 then my position of the 5th and so on need to changed.
So I need to use the common funda to avoid the problem.
Regards
Anil kumar Ravilla
This is how I tried
_click(_image(/NEW[]/, _near(_heading2("List Of Roles))));
_click(_image("/NEW\[[.]\]/", _near(_heading2("List Of Roles))));
I'm not sure this statement works... it should match "NEW[8]",
or you just use
_click(_image("/NEW\[/", _near(_heading2("List Of Roles))));
witch should match any "NEW[...." stuff
Rule 1: Sahi is Simple
_click(_image("New", _near(_heading2("List Of Roles))));