Xpath of ul element:
resultSet = driver.find_element_by_xpath("//section[@id='abc']/ul")
How to loop through only li elements inside a ul, given above ul element xpath?
You can search for li
nodes starting from already defined ul
with below code:
resultSet = driver.find_element_by_xpath("//section[@id='abc']/ul")
options = resultSet.find_elements_by_tag_name("li")
To loop through list of li
nodes simply do
for option in options:
print(option.text)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With