How do I check if an element is inside a specific tag, and NOT the entire document?
To give you an idea:
for child_element in parent_element:
print(child_element)
Let's say we have a parent element.
parent_element=driver.find_element((By.TAG_NAME,"ul"))
We can then access elements within that element by doing the following.
try:
child_element=parent_element.find_element((By.XPATH,"./li"))
print(child_element)
except:
pass
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.