elem = "a"
soup.find_all(elem, string="Text") # Find all elems(a) with text "Text"
elems_list = soup.findAll('p')
start_pos = 0
for e in elem_list:
end_pos = len(e)
if subtext in e:
elem_found = True
elem = e
break
if elem_found:
print("Element with subtext ", subtext, " found: ",e)