preload

Custom lists: Select Multi / Select All with WinRunner

Posted by Albert Gareev on Dec 23, 2007 | Categories: How to

How to select multiple items in custom list

Description

Select each item with “Control” key (Ctrl on keyboard).


public function _list_select_multy(in list, in items) {
 auto rc, count, i, k;
 auto dvItem[];
 
 count = split(items, dvItem, ",");
 if (count < 1) {
  return(E_GENERAL_ERROR);   
  }
   
 rc = list_select_item(list, str_trim(dvItem[1]));
 if (rc != E_OK) {
  return(rc);
  }

 if (count == 1)
  return(rc);

 type("<kCtrl_L>-");
 for (i=2;i<=count;i++) {
  wait(1);
  rc = list_select_item(list, str_trim(dvItem[i]));
  if (rc != E_OK) {
   type("<kCtrl_L>+");
   return(rc);
   }
  } 
 type("<kCtrl_L>+");

 return(E_OK);  
}

How to select all items  in custom list

Description

Select first and then select last item with “Shift” key (Shift on keyboard).


public function _list_select_all(in list) {
 auto rc, items_count;
 
 rc = list_select_item(list, "#0");
 if (rc != E_OK) {
  return(rc);
  }

 list_get_info(list, "count", items_count);
 items_count--;

 type("<kShift_L>-");
 rc = list_select_item(list, "#"&items_count);
 if (rc != E_OK) {
  type("<kShift_L>+");
  return(rc);
  }
 type("<kShift_L>+");

 return(E_OK);  
}


Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.