Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

beautifulsoup find element containing 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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #beautifulsoup #find #element #text
ADD COMMENT
Topic
Name
8+6 =