Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Get text without inner tags text in selenium

data = '''<td height="21" class="xl7024240">Other Financial Services<font class="font711087"><sup>1</sup></font></td>'''

from bs4 import BeautifulSoup
import bs4

soup = BeautifulSoup(data, 'html.parser')

external_span = soup.find('td')

text = []
for x in external_span:
    if isinstance(x, bs4.element.NavigableString):
        text.append(x.strip())
print(" ".join(text))
 
PREVIOUS NEXT
Tagged: #Get #text #tags #text #selenium
ADD COMMENT
Topic
Name
7+8 =