I am trying to append the name of a value which it's child element is less then 120.
My code is
list = []
rate = driver.find_elements(By.XPATH, '//span[@class="sFive"]')
for e in rate:
if int(e.text) < 120:
title=e.find_element(By.XPATH, x).text #find ancestor element
list.append(title)
print(list)
The x is where I need to find the grandparent which is the 21st span element up that branch.
The span element is
<span data-slnm="Brand" class="ng-star-inserted">Inter</span>
The target element being:
To locate the element which is the 21st grandparent
<span>element up that branch you can use the either of the following locator strategies:Identifying the 21st
<span>ancestor:Identifying the specific
<span>ancestor: