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.
_under element with constant variable
how to I replace an element using _under
Element found: _div(3, _under(_div("fill_space")))
I am unable to above Div (using _under) and assign it to a constant var due to the _underscore and the "double quotes"
Tried the following assignment:
var $aboveFoundDiv = '3 _under(_div("fill_space"))' ;
var $aboveFoundDiv = "3, \_under(\_div(\"fill\_space\"))" ;
var $aboveFoundDiv = "3, \_under(\_div(/fill_space/))" ;
_rightClick(_div($aboveFoundDiv) ) ;
This keep adding the "" so after the substition, it becomes:
_div("3, _under(_div("fill_space"))") //invalid
vs.
_div(3, _under(_div("fill_space"))) //valid
Element found: _div(3, _under(_div("fill_space")))
I am unable to above Div (using _under) and assign it to a constant var due to the _underscore and the "double quotes"
Tried the following assignment:
var $aboveFoundDiv = '3 _under(_div("fill_space"))' ;
var $aboveFoundDiv = "3, \_under(\_div(\"fill\_space\"))" ;
var $aboveFoundDiv = "3, \_under(\_div(/fill_space/))" ;
_rightClick(_div($aboveFoundDiv) ) ;
This keep adding the "" so after the substition, it becomes:
_div("3, _under(_div("fill_space"))") //invalid
vs.
_div(3, _under(_div("fill_space"))) //valid
This discussion has been closed.
Comments
You cannot assign 2 values to a single variable and use it like this.
You could do the following:
1) Store _div(3, _under(_div("fill_space"))) itself into a variable.
var $el = _div(3, _under(_div("fill_space")));
_rightClick($el);
2) Create a string and then eval it.
var $aboveFoundDiv = '3, _under(_div("fill_space"))' ;
var $el = eval("_div(" + $aboveFoundDiv + ")");
_rightClick($el);
or
var $aboveFoundDiv = '3, _under(_div("fill_space"))' ;
_rightClick(eval("_div(" + $aboveFoundDiv + ")"));
Regards,
Narayan
Thanks Narayan...you may close this thread.