I'm trying to find a way to get the likes counter from any given Twitter post.
For example, this tweet: https://twitter.com/whale_alert/status/1508925640745140232
I have tried using every element around that text with no success.
What should I call on to get the like counter from tweets?
The element with number of likes is left to the element with text as
Likes
.To extract the number of likes you need to induce WebDriverWait for the visibility_of_element_located() and you can use the relative
Left of
locator strategy:Using XPATH and
RelativeBy(object)
:Console Output:
Note : You have to add the following imports :
tl; dr
Selenium 4 - Relative Locators