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.

Issue with the click script

ei05056ei05056 Members
edited November -1 in Sahi - Open Source
Hi!
First of all I'm sorry if this isn't the right place to post this question or it is already answered, but I didn't find it anywhere.

I'm having a problem with the following script:

var $tries = 0;
_setValue(_textbox(0), "upadmin");
_setValue(_password(0), "upadmin");
_click(_cell("Login"));
_setSelected(_select(0), ["NSOM - Service (SOM)"]);
_click(_cell("Select"));
_click(_cell("Task"));
_wait(1000);
_click(_cell("Details"));
_wait(1000);
_click(_cell("Details"));
_wait(1000);
_click(_div(0,_under(_cell("Details"))));
_wait(1000);
_click(_cell("Actions"));
_highlight(_cell("Proceed"));
_wait(4000);
_highlight(_cell("Reject"));
_wait(4000);
_click(_cell("Reject"));

What happens here is that the button that is clicked is "Proceed" and not "Reject". When I try to get other alternative for the id in the Sahi Controller Record the result is the same. Sahi recognizes 2 different buttons but clicks in the same every time at this point, even if I click through Sahi Controller. I tried to highlight the different buttons and it works, they are highlighted separately, so I can't figure out what the problem can be.


Sahi Build: V3.5
OS Name: Windows 7Professional 64bits
Browser name: Chrome 16.0.912.75 m and Mozilla Firefox 3.6.15

Cheers

Comments

  • Hi ei05056,

    When elements are not uniquely identifiable by themselves, we should try to identify them in relation to either some element near them or by the element in which they are contained.

    ie: _near() API, _in() API

    For more informtation:

    http://sahi.co.in/w/all-apis

    Regards
    Sumitra
  • Hi Sumitra,

    Thanks for the help, but it didn't work.
    The reject id is unique in all document nevertheless I tried all sorts of things like
    _click(_cell("Reject"));
    _click(_cell(0,_near(_cell("Reject"))));
    _click(_div(0,_near(_cell("Reject"))));
    And all the alternatives with the same combinations, still have the same problem the other button in the menu is clicked instead of the reject one.

    I noticed something that might be important, both "Proceed" button and "Reject" button share one of the alternatives being _table("menuTable") present in the alternative list of both buttons.

    Any suggestion?

    Cheers
Sign In or Register to comment.