I'm trying to iterate through multiple nodes and receive various child nodes from the parent nodes. Assuming that I've something like the following structure:
<div class="wrapper">
<div class="item">
<div class="item-footer">
<div class="item-type">Some data in here</div>
</div>
</div>
<!-- More items listed here -->
</div>
I'm able to receive all child nodes of the wrapper container by using the following.
wrapper = driver.find_element(By.XPATH, '/html/body/div')
items = wrapper.find_elements(By.XPATH, './/*')
Anyways I couldn't figure out how I can now receive the inner HTML of the container containing the information about the item type. I've tried this, but this didn't work.
for item in items:
item_type = item.item.find_element(By.XPATH, './/div/div').get_attribute('innerHTML')
print(item_type)
This results in the following error:
NoSuchElementException: Message: Unable to locate element:
Does anybody knows how I can do that?