selenium get all child elements python 1

selenium get all child elements python

el = driver.find_element_by_name('a')

// Two ways to get all children elements.
// By css selector:
childrend_by_css = el.find_elements_by_css_selector("*")
// By xpath:
childrend_by_xpath = el.find_elements_by_xpath(".//*")

Here is what the above code is Doing:
1. Find the element with the name ‘a’.
2. Find all children elements of the element found in step 1.
3. Find all children elements of the element found in step 1.

Similar Posts