I have the following html page where I am trying to locate the word silver
and keep count on how many were found.
This is just two showing here but it can generate more so I don't know the exact count.
<tr id="au_4" class="odd">
<td>Silver</td>
</tr>
<tr id="au_4" class="even">
<td>Silver</td>
</tr>
This is what I tried but no luck:
count = driver.find_elements_by_xpath("//td[text()='Silver']")
count
is a list of all elements that were found. In order to find its length, you should:
len(count)
I highly recommend you to go through the docs to better understand how Selenium works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With