ElementList¶
-
class
splinter.element_list.ElementList(list, driver=None, find_by=None, query=None)¶ Bases:
objectCollection of elements.
Each member of the collection is by default an instance of
ElementAPI.Beyond the traditional list methods,
ElementListprovides some other methods, listed below.There is a peculiar behavior on ElementList: you never get an
IndexError. Instead, you get anElementDoesNotExistexception when trying to access a non-existent item:>>> element_list = ElementList([]) >>> element_list[0] # raises ElementDoesNotExist
-
first¶ An alias to the first element of the list.
Example
>>> assert element_list[0] == element_list.first
-
is_empty() → bool¶ Check if the ElementList is empty.
Returns: True if the list is empty, else False Return type: bool
-
last¶ An alias to the last element of the list.
Example
>>> assert element_list[-1] == element_list.last
-