I'm trying to get a text from a class tag using selenium and I kinda hit a dead end. All the classes name are the same "legend-row" but I only need the 3rd one, the one that has "1.09TB" text.
I have tried to find the element by xpath and no luck the only way that I managed to get the value from those classes was by using the below line of code
driver.find_element_by_class_name("legend-row").text
which gets me all the texts, 134.46Tb, 8.96TB, 1.09TB and Threshold Level 90%. Is there any way that I can only query the 3rd one? See below the classes from the URL
<g class="legend" style="font-size: 14px;">
<g class="legend-row" transform="translate(102,-32.400000000000006)">
<rect y="-30.599999999999998" width="14" height="14" style="fill: rgb(125, 123, 140); stroke: rgb(125, 123, 140);"/>
<text x="18" y="-18">Allocated:</text>
<text x="109.421875" y="-18"> 134.46 TB</text>
</g>
<g class="legend-row" transform="translate(102,-10.800000000000004)">
<rect y="-30.599999999999998" width="14" height="14" style="fill: rgb(110, 37, 133); stroke: rgb(110, 37, 133);"/>
<text x="18" y="-18">Spare:</text>
<text x="109.421875" y="-18"> 8.96 TB</text>
</g>
<g class="legend-row" transform="translate(102,10.799999999999997)">
<rect y="-30.599999999999998" width="14" height="14" style="fill: rgb(130, 224, 170); stroke: rgb(130, 224, 170);"/>
<text x="18" y="-18">Unallocated:</text>
<text x="109.421875" y="-18"> 1.09 TB</text>
</g>
<g class="legend-th-row" transform="translate(102,32.39999999999999)">
<text x="0" y="0" class="chart-status-icon" style="font-size: 14px; fill: rgb(242, 175, 0);"></text>
<text x="18" y="0">Threshold Level: 90%</text>
</g>
</g>
Thanks for the help,