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.

Looking for an item in a dropdown list

DougStevensDougStevens Members
edited November -1 in Sahi - Open Source
I'm trying to determine if a given value is in a dropdown. However, for one I know is in the list, this does not find it. I have looked at string length to see if maybe there are extraneous spaces, but I don't find any.

_click(_button("Add[2]")); // make the drop down visible
// determine if the value sought is in the list
_set($nItemsInDropdown,_select(14).options.length);
for(var $y=0;$y<$nItemsInDropdown;$y++){
if($propSelectExistingBorrower == _select(14).options[$y].value){
$IsInList = "Y";
}
}

if($IsInList == "Y"){
_setSelected(_select(13),$propLivingTrustRole);
if($propLivingTrustExistingBorrower.toUpperCase() == "TRUE"){
_click(_radio("existingOrNewBorrowerRadio"));
}
else{
_click(_radio("existingOrNewBorrowerRadio[1]"));
}
_setSelected(_select(14),$propSelectExistingBorrower);
_click(_button("OK[2]"));
}
else{
_log($propSelectExistingBorrower + " was not in the dropdown list");
_click(_button("Cancel[2]"));
}
$IsInList = "N";
$TrustIndx++;

Comments

  • narayannarayan Administrators
    Hi Doug,

    $propSelectExistingBorrower == _select(14).options[$y].value
    should be
    _condition($propSelectExistingBorrower == _select(14).options[$y].value)
  • Thanks. I got it working using a _set, but I like _condition better.
This discussion has been closed.