findx
The command to get a list of Elements that match the XPath selector.
Syntax
py.findx(xpath: str) -> Elements
py.findx(xpath: str, timeout: int) -> Elements
---or---
Element.findx(xpath: str) -> Elements
Element.findx(xpath: str, timeout: int) -> ElementsUsage
# Yield all Elements in .nav with tag name of a
py.get(".nav").findx("//a")
---or---
# Yield all Elements in document with id of 'button'
py.findx("//*[@id='button']")
---or--- # store in a variable
elements = py.findx("//*[@id='button']")
---or--- # chain an Element(s) command
# if one element is found, still returns a list of 1: [Element]
py.findx("//*[@id='button']").first().click()
---or--- # control the timeout in any of the above usages
py.findx("//a[@href='/about']", timeout=5).length()Arguments
Yields
Examples
Last updated