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.
Getting [object] as a button value in Sahi
in Sahi Pro
I am working on Sahi and got stuck with this issue.
Issue: I am getting [object] as a value instead of value "true" while asserting the button attribute.
Code: File 1: category.sah
_include("newCatLib.sah");
_click($tabCategory);
_assertEqual("Category Details", _getText($heading), "");
disabledBtn($lowLvlCatEdtBtn, true, $subLvlCatEdtBtn, true);
File 2: newCatLib.sah
var $tabCategory = _span("title[2]");
var $heading = _heading3("page-title");
var $highLvlCatDrpdn = _select(0);
var $lowLvlCatDrpdn = _select(1);
var $subLvlCatDrpdn = _select(2);
var $lowLvlCatEdtBtn = _button(0);
var $subLvlCatEdtBtn = _button(1);
function disabledBtn($lowLvlCatEdtBtn, $boolean1, $subLvlCatEdtBtn, $boolean2) {
var $isDisabledBtn1 = _getAttribute($lowLvlCatEdtBtn, "disabled");
_assertEqual($boolean1, $isDisabledBtn1);
var $isDisabledBtn2 = _getAttribute($subLvlCatEdtBtn, "disabled");
_assertEqual($boolean2, $isDisabledBtn2);
}
Execution Log:
[-] **disabledBtn([object], true, [object], true)**
_assertEqual(true, true) [257 ms] [08:28:29.537]
_assertEqual(true, true) [253 ms] [08:28:29.790]
I have checked Button accessor in HTML code which is correct.
Let me know if more details needed.
Help out. Urgent.
Issue: I am getting [object] as a value instead of value "true" while asserting the button attribute.
Code: File 1: category.sah
_include("newCatLib.sah");
_click($tabCategory);
_assertEqual("Category Details", _getText($heading), "");
disabledBtn($lowLvlCatEdtBtn, true, $subLvlCatEdtBtn, true);
File 2: newCatLib.sah
var $tabCategory = _span("title[2]");
var $heading = _heading3("page-title");
var $highLvlCatDrpdn = _select(0);
var $lowLvlCatDrpdn = _select(1);
var $subLvlCatDrpdn = _select(2);
var $lowLvlCatEdtBtn = _button(0);
var $subLvlCatEdtBtn = _button(1);
function disabledBtn($lowLvlCatEdtBtn, $boolean1, $subLvlCatEdtBtn, $boolean2) {
var $isDisabledBtn1 = _getAttribute($lowLvlCatEdtBtn, "disabled");
_assertEqual($boolean1, $isDisabledBtn1);
var $isDisabledBtn2 = _getAttribute($subLvlCatEdtBtn, "disabled");
_assertEqual($boolean2, $isDisabledBtn2);
}
Execution Log:
[-] **disabledBtn([object], true, [object], true)**
_assertEqual(true, true) [257 ms] [08:28:29.537]
_assertEqual(true, true) [253 ms] [08:28:29.790]
I have checked Button accessor in HTML code which is correct.
Let me know if more details needed.
Help out. Urgent.
Best Answer
-
you get true, as expected. I don't see any problem. See also http://stackoverflow.com/questions/37190895/getting-object-as-a-button-value-in-sahi/37203042#37203042
