first
The command to get the first Element in a list of Elements.
Syntax
Elements.first() -> Element
Usage
py.find("li").first()
---or--- # store in a variable
element = py.xpath("//a").first()
---or--- # chain an Element command
py.get("ul > li").children().first().click()
# Errors, 'get' yields Element, not Elements
py.get("ul > li").first()
Arguments
None
Yields
Element - The first Element in the list of Elements
Raises
IndexError if Elements is empty
Last updated