ElementList¶
-
class
splinter.element_list.ElementList(list, driver=None, find_by=None, query=None)¶ Bases:
objectList of elements. Each member of the list is (usually) an instance of
ElementAPI.Beyond the traditional list methods, the
ElementListprovides some other methods, listed below.There is a peculiar behavior on ElementList: you never get an
IndexError. Instead, you can anElementDoesNotExistexception when trying to access an inexistent item in the list:>>> element_list = ElementList([]) >>> element_list[0] # raises ElementDoesNotExist
-
first¶ An alias to the first element of the list:
>>> assert element_list[0] == element_list.first
-
is_empty()¶ Returns
Trueif the list is empty.
-
last¶ An alias to the last element of the list:
>>> assert element_list[-1] == element_list.last
-