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 with array variable are not identified using regular expression
There is a main field "issue". When selecting an item in the issue field, the "action" field with corresponding sub items will be displayed.
During playback, it is not identifying the "action" field displayed if I have selected the second or the following items in the "Issue" field. It is working only for the first item selected.
Case 1- Selecting the first item in the "issue" fild
The above statements are executing successfully and passing the test. it is selecting the values properly in both list boxes.
Case 2- selecting the second item in the issue field
The above test is failing, the second statement is not executing. It is not identifying the the _select("actionTaken[][1]") field and not putting the value during playback. The log file shows the following error.
Error: Option not found: item2sub1
Please let me know how can i continue execution without fail.
Sahi v3.5
browser FF 3.6.24
Regards,
Anoop
During playback, it is not identifying the "action" field displayed if I have selected the second or the following items in the "Issue" field. It is working only for the first item selected.
Case 1- Selecting the first item in the "issue" fild
_setSelected(_select("issuesDiagonised[]"), ["item1"]);
_setSelected(_select("/actionTaken/"), "item1sub1"); //actual name of the object during playback is _select("actionTaken[]")
The above statements are executing successfully and passing the test. it is selecting the values properly in both list boxes.
Case 2- selecting the second item in the issue field
_setSelected(_select("issuesDiagonised[]"), ["item2"]);
_setSelected(_select("/actionTaken/"), "item2sub1"); //actual name of the object during playback is _select("actionTaken[][1]")
The above test is failing, the second statement is not executing. It is not identifying the the _select("actionTaken[][1]") field and not putting the value during playback. The log file shows the following error.
Error: Option not found: item2sub1
Please let me know how can i continue execution without fail.
Sahi v3.5
browser FF 3.6.24
Regards,
Anoop
This discussion has been closed.
Comments
Please use some wait after first statement like below.
_setSelected(_select("issuesDiagonised[]"), ["item2"]);
wait(3000)// 3 seconds
_setSelected(_select("/actionTaken/"), "item2sub1"); //actual name of the object
I thinks it will works fine...
Regards
Raja
You will have to use DOM relation for Case2( i.e _in() , _under(), _near() API's).
For more information: http://sahi.co.in/w/all-apis
Regards
Sumitra
_setSelected(_option("item2sub1", _in(_select("/actionTaken/"))));
it is passing the test but not putting the value in the "action" field.
I also tried using assertion statement..i think this usage is correct.. similar usage in other places works.
_assertExists(_option("item2sub1", _in(_select("/actionTaken/"))));
this also assertion failed...but actually the option "item2sub1" is present in the field _select("actionTaken[][12]")
I feel the problem is that _select("actionTaken[][12]") is not identified in playback by using _select("/actionTaken/")
As u suggested I got it working by using _near with label _cell("item2") all statements are executing properly.
If i don't use _near it is failing. Still i am confused between case 1 and 2. Even though both cases are same(just an order change for the items selected from the list). Case1 is passing without using _near but case2 is not.
Thanks,
Anoop
As you had mentioned that :
For case 1: actual name of the object during playback is _select("actionTaken[]")
For case 2: actual name of the object during playback is _select("actionTaken[][1]");
Sahi was not able to find _select("/actionTaken/") for Case2 as the name was
_select("actionTaken[][1]").If you are mentioning it in a regular expression Sahi will try to find _select() with some DOM relation.
Regards
Sumitra