'Python Selenium Extract all text between two spots

<a class="AAA" fid="41553" href="..">AAA</a></TD><td bgcolor = eeeeee><div align="center">
<a class="AAA" fid="43455" href="..">BBB</a></TD><td bgcolor = eeeeee><div align="center">
<a href="ctop.php?vdate=20220123"><font size=1>
01-23</div>
</a></td><td bgcolor = eeeeee><div align="center">abc</div></td><td bgcolor = eeeeee>
<div align="left">...</div></td><td bgcolor = eeeeee><font size=1>1200</td><td bgcolor = eeeeee>
<div align="left">...</div></td>
<td bgcolor = eeeeee><div align="center">....G1</div></td bgcolor = eeeeee><td  bgcolor = eeeeee><div align="left">  <font size=1>109<font color=blue><i>+3</i></font></td>
<td bgcolor = eeeeee><div align="center"><font size=1> 126</div></td><td bgcolor = eeeeee>
<div align="center"> <font size=1>1230</div></td><td bgcolor = eeeeee>
<div align="left">           <br><font color=red></div></td><td bgcolor = eeeeee><div align="center">....</div>
<a class="AAA" fid="47878" href="..">CCC</a></TD><td bgcolor = eeeeee><div align="center">
<a class="AAA" fid="47892" href="..">DDD</a></TD><td bgcolor = eeeeee><div align="center">

Lets say I want to navigate two spots by the start and end of the class 'AAA'. And after that I want to extract all the text in between. Can I use a if else condition on Selenium?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source