selenium - Integer variable from a custom keyword in the robot framework -
i have custom keyword in robot framework counts items of list. works in underlying python file , prints number 5 when 5 elements exists in list.
then want bring value robot framework. instead of number get: ${n_groups} <built-in method count of list object @ 0x03b01d78>
the code of robot file:
*** test cases *** count groups ${n_groups} setup groups count groups log console ${n_groups} how item-count of list integer value?
here part of python file:
@keyword(name="count groups") def count_groups(self): n = self.cur_page.count_groups() return n and more low level python file:
def count_groups(self): ele_tc = self._wait_for_treecontainer_loaded(self._ef.get_setup_groups_treecontainer()) children_text = self._get_sublist_filter(ele_tc, lambda ele: ele.find_element_by_tag_name('a').text, true) return children_text.count
your function count_groups returning children_text.count. children_text list, , you're returning count method of object, explains error you're seeing. it's no different if did return [1,2,3].count.
perhaps intend call count function , return results? or, perhaps intending return length of list? it's hard see intent of code is.
in either case, robot reporting you're doing: you're returning reference function, not integer. guess want return number of items in list, in case should change return statement to:
return len(children_text)
Comments
Post a Comment