18 January 2026:


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.

DropDown Selection From List of Values

jrsreenivasjrsreenivas Members
edited November -1 in Sahi - Open Source
Hi
I have a drop down list which consist of 3 values in the drop down list with Empty Value [ Null] with starting
Ex : Blank Space, Administrator,Agent and Supervisor

I want to check the dropdown condition so that the drop down should consist of any of the 3 value that are Administrator or Agent or Supervisor

i tried with the below script but its not working

_assertExists(_condition(_setSelected(_select("ddlTaskGroup"),"Administrator"||"Agent"||"Supervisor")));

Please let me know if any one of you have a solution

Thanks

Sreenivas

Comments

  • narayannarayan Administrators
    Hi Sreenivas,

    There are multiple mistakes in this. Please have a look at the Sahi APIs to get a hang of what each one does. http://sahi.co.in/w/sahi-apis

    Have a look at _getSelectedText and the various _assert APIs

    In your case you could do
    _assertNotNull(_getSelectedText(_select("ddlTaskGroup")).match(/Administrator|Agent|Supervisor/))
    

    Regards,
    Narayan
  • Hi Narayan Thanks for the solution the above one dint work in my case
    the below one worked for me .

    _assertNotEqual(_getSelectedText(_select("ddlTaskGroup")).match(/Administrator|Agent|Supervisor/));
  • narayannarayan Administrators
    Hi Sreenivas,

    Both of them should have worked though the first one is the right way.
    _assertNotEqual takes 2 parameters which are compared against each other. In the absence of the second, the second parameter is considered null. So basically you are saying
    _assertNotEqual(xx, null) which is the same as _assertNotNull(xx)

    Are you sure the first one does not work?

    Regards,
    Narayan
  • yes i am sure in my case
Sign In or Register to comment.