🍺 Join Clicknium for quality support, growth opportunities, and a supportive community

WebElement.find_elements_by_xpath

def find_elements_by_xpath(
self,
xpath: str,
timeout: int = 30
) -> List[WebElement]

In the active browser, find elements by the given XPath.

Parameters:
 xpath[Required]: str
   the XPath of the element to find.
 timeout: int
   Timeout for the operation, the unit is second, and the default value is 30 seconds.

Returns:
 List of WebElement objects.

Example:


from clicknium import clicknium as cc

chrome_tab = cc.chrome.open("https://bing.com/images")

# find elements by XPath
element = chrome_tab.find_element_by_xpath("//*[@id=\"ilp_t\"]")

# find sub elements by XPath
webelements = element.find_elements_by_xpath(".//*[@id=\"ilp_t\"]/div[1]/div/*")
print("count: " + str(len(webelements)))
for i in range(3):
webelements[i].highlight()

Previousfind_elementsNextfind_elements_by_css_selector

What are your feelings
Updated on 29 August 2023