I have html string and would like to find the text elements and replace with the tokens. I used beautifulsoup to get the data but get_text is giving only text not corresponding elements. How to go thorugh html string from root node to last node and finding out the text elements to replace with the tokens I define. I get dynamic large html string from source. small example has been given
<html>
<body>
<p>Hi</p>
<p>Hello</p>
</body>
</html>
To
----
<html>
<body>
<p>Token1</p>
<p>Token2</p>
</body>
</html>