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.
How to select values randomly in combo box
Hi All,
I need to select value from combo box and want to delete it in SAHI. When i execute the next time i want to select a different value from combo box. Is it possible?
Any one help me with code or some idea regarding this...
Thanks in advance...
Kind regards,
Selvi
I need to select value from combo box and want to delete it in SAHI. When i execute the next time i want to select a different value from combo box. Is it possible?
Any one help me with code or some idea regarding this...
Thanks in advance...
Kind regards,
Selvi
This discussion has been closed.
Comments
_setSelected(_select("selId"), 1); will choose 2nd option. (indexing starts from 0.)
I am trying to assert a value in a combo box, but it is showing me error.
The assert statement is
_assertExists(_option(_select("FSCList"), "testitem"));
When i am running the script it is always failing, the log shows as follows
_assertExists(_option(_select("FSCList"), "testitem"));
TypeError: id.match is not a function
http://s-ws.geodesic.net/_s_/spr/concat.js:2079
http://s-ws.geodesic.net/_s_/spr/concat.js:2234
http://s-ws.geodesic.net/_s_/spr/concat.js:3951
How do i write the code for asserting an item in a combo box?
Regards,
Anoop
I just googled an combobox example http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx and teh Sahi controller let's me select the entries without problemes, so using should be enough.
Regards
Wormi
It has multiple list items where as one item in the list is "testitem"
I tried the code u gave in this way it is not working
_assertExists(_select("FSCList")("testitem"));
If i do a select operation in the list, it is working fine. The code is:
_setSelected(_select("FSCList"), "testitem");
this is executing properly in playback.
But i'm not able to assert an item for existence or nonexistence, script always fails
_assertExists(_option(_select("FSCList"), "testitem"));
_assertNotExists(_option(_select("FSCList"), "testitem"));
I'm not sure whether it is because of the wrong usage of _option api.
I saw the post abt the same problem.. however it doesn't work for me..
http://sahi.co.in/forums/viewtopic.php?id=2610
Regards,
Anoop
You could try this
Regards,
dkulkarni
I tried it. Its working perfectly!
Thanks a lot.
But i'm wondering why it is not working with the code i used even though it was the way described in tutorials and other forum posts. So i think i need to use _in api for all list assersions, isn't it? or it is specific to the type of combobox where i was testing?
Regards,
Anoop
Your usage was basically incorrect.
If you want to assert that element exists on the page, then you can use
_assertExists(_option("testitem"));
However, if you wish to assert that element exists on the page AND inside the dropdown, use
_assertExists(_option("testitem", _in(_select("FSCList"))));
Regards,
dkulkarni