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.
Object not identified properly with _near()
Users Status
User1 [edit icon]
User2 Deactivated
User3 [edit icon]
User4 Deactivated
In the above list if the user is active it will show a edit icon, where it opens the edit page when clicking. If deactivated it will show a "Deactivated" text.
I want to check whether the status of "user4" is deactivated and pass if it is the same. If the status of the user is something else (the edit icon) the test should fail. I tried the following assersion
_assertExists(_cell("Deactivated"), _near(_cell("user4")));
_assert(_isVisible(_cell("Deactivated"), _near(_cell("user4"))));
The problem i'm facing is the test is passing even if the "user4" is not present in the list. It is taking the value of "user2" and passing the test.
Tried using _in() and _under() also.. didn't work
Please let me know how can I do this test properly.
Sahi version: OS 3.5
Browser: FF 3.6.24
OS: Windows 2003
User1 [edit icon]
User2 Deactivated
User3 [edit icon]
User4 Deactivated
In the above list if the user is active it will show a edit icon, where it opens the edit page when clicking. If deactivated it will show a "Deactivated" text.
I want to check whether the status of "user4" is deactivated and pass if it is the same. If the status of the user is something else (the edit icon) the test should fail. I tried the following assersion
_assertExists(_cell("Deactivated"), _near(_cell("user4")));
_assert(_isVisible(_cell("Deactivated"), _near(_cell("user4"))));
The problem i'm facing is the test is passing even if the "user4" is not present in the list. It is taking the value of "user2" and passing the test.
Tried using _in() and _under() also.. didn't work
Please let me know how can I do this test properly.
Sahi version: OS 3.5
Browser: FF 3.6.24
OS: Windows 2003
This discussion has been closed.
Comments
_assertExists(_cell("Deactivated", _near(_cell("user4"))));
_assert(_isVisible(_cell("Deactivated", _near(_cell("user4")))));
Regards,
Anoop
You will have to use a condition to work with the above code.
Explanation:
_assertExists(_cell("deactivated", _near(_cell("user4")))); will return true because it is referenced with user4 which is not visible but is hidden.
Use:
if(_isVisible(_cell("user4")))
_assertExists(_cell("deactivated", _near(_cell("user4"))));
else
_alert("fail");
Regards
Sumitra
Users Status
User1 Blocked
User2 Deactivated
User3 Active
User4 Active
The code you provided is passing the test for the above list. I want to pass the test only if the status of "User4" is "Deactivated".
You can use:
_assertContainsText("deactive", _cell(0, _near(_cell("user4")), _under(_cell("status"))));
Regards
Sumitra
Code used in script (instead of User4 it is TestUser4 and instead of Status it is Action described in the previous posts):
_assert(_isVisible(_cell("TestUser4")));
_assertContainsText("Deactivated", _cell(0, _near(_cell("TestUser4")), _under(_cell("Action"))));
It showed me the following error when opened the log file:
Test Total Steps Failures Errors Success Rate Time Taken (ms)
test.sah 2 0 1 50% 12282
Starting script
_assert(_isVisible(_cell("TestUser4"))); at Dec 15, 2011 2:07:37 PM
_assertContainsText("Deactivated", _cell(0, _near(_cell("TestUser4")), _under(_cell("Action"))));
TypeError: obj is null
http://s-ws.testurl.net/_s_/spr/concat.js:906
http://s-ws.testurl.net/_s_/spr/concat.js:893
http://s-ws.testurl.net/_s_/spr/concat.js:3856
http://s-ws.testurl.net/_s_/spr/concat.js:3016
http://s-ws.testurl.net/_s_/spr/concat.js:3016
http://s-ws.testurl.net/_s_/spr/concat.js:2822
Instead of_tableHeader("Action") I used _cell("Action") in the code which resulted in unidentifying the object during playback.
It worked fine!! Thanks a lot