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.
How to simulate a click on div class element ?
Sahi 3.5 OpenSource
Version : V3.5
Build : 2011-07-19
Browser : Firefox (IE 8 and 9, Chrome)
In a web page, I have a rectangular clickable area. A click on this zone opens a new window for selecting other user's options.
Here is the HTML code thar corresponds to this zone, in front of which is displayed "Compétences :".
<tr>
<td class="name align-top">Compétences :</td>
<td id="SkillId" class="value">
<div class="inputLook" onclick="EditZoneEx('SkillId', '2', 'pages/services/')"> </div>
</td>
</tr>
With the Sahi controller to simulate a click on this area, the recorded line is :
_click(_div("inputLook[6]"));
The trouble is that, the index '6' will probably change in the future as the development team will add some other elements in this web page.
I have tried to use : _click(_div("SkillId")); but it doesn't work...
How to simulate a click action using the DOM or positional relations functions (_near, ...) bypassing the use of static numerical identifier ('6') ?
Thanks for your help.
Version : V3.5
Build : 2011-07-19
Browser : Firefox (IE 8 and 9, Chrome)
In a web page, I have a rectangular clickable area. A click on this zone opens a new window for selecting other user's options.
Here is the HTML code thar corresponds to this zone, in front of which is displayed "Compétences :".
<tr>
<td class="name align-top">Compétences :</td>
<td id="SkillId" class="value">
<div class="inputLook" onclick="EditZoneEx('SkillId', '2', 'pages/services/')"> </div>
</td>
</tr>
With the Sahi controller to simulate a click on this area, the recorded line is :
_click(_div("inputLook[6]"));
The trouble is that, the index '6' will probably change in the future as the development team will add some other elements in this web page.
I have tried to use : _click(_div("SkillId")); but it doesn't work...
How to simulate a click action using the DOM or positional relations functions (_near, ...) bypassing the use of static numerical identifier ('6') ?
Thanks for your help.
Comments
Sorry for that incovenience.
It uses regular expressions to identify the object.
For example:
_click(_div("/inputLook.*/"));
Other examples:
_link(12) Using index in a page; assuming this is the 13th link on the page
_link("sahi_link") Using id as a string
_link(/.*_link/) Using id as a regular expression
_link("Link to Sahi website") Using visible text as a string
_link(/Link to .* website/) Using visible text as a regular expression
_link("/Link to .* website/") Using visible text as a regular expression
_link({id:"sahi_link"}) Using an associative array with id
_link({sahiText:" /Link to .*/"}) Using an associative array with visible text as regular expression
Oscar C.